detecting screen res in netscrape

A

Andy

got the usual script:

<script language="JavaScript" type="text/JavaScript">
var s_height = screen.Height
var s_width = screen.Width
var s_screen= screen.colorDepth

if ( s_height == "480" && s_width == "640" )

{
window.location = "bigframe/index.htm"
}

else if

( s_height == "800" && s_width == "600" )

{
<do this>
}


but doesn't seem to want to work in netscape is there antway of doing it
 
J

Janwillem Borleffs

Andy said:
got the usual script:

<script language="JavaScript" type="text/JavaScript">

The type should be lowercased: text/javascript
var s_height = screen.Height
var s_width = screen.Width

These properties should be called lowercased also:

var s_height = screen.height
var s_width = screen.width


JW
 
M

Michael Winter

Keith Bowes wrote on 07 Dec 2003:
Why? The type is an HTML attribute, and hence is case insensitive.

That /particular/ attribute is case-insensitive. Most, but not all,
are (id and class being important ones).

Mike
 
S

Stephen Poley

got the usual script:

<script language="JavaScript" type="text/JavaScript">
var s_height = screen.Height
var s_width = screen.Width
var s_screen= screen.colorDepth

if ( s_height == "480" && s_width == "640" )

{
window.location = "bigframe/index.htm"
}

else if
....

If you're going to do this sort of thing you ought to use window size,
not screen size. The window is after all what you have to display in.
For a working example, you could have a look at a bit of playing around
I've done: http://www.xs4all.nl/~sbpoley/webmatters/resize.html
though there may well be better versions around.

In any case, make sure that a reader without Javascript gets some
reasonable version of the page.
 
T

Thomas 'PointedEars' Lahn

Andy said:
got the usual script:

You mean you copy-pasted the usual crap. Yes, indeed, you did.
<script language="JavaScript" type="text/JavaScript">

Skip the language attribute, it is deprecated and not required as
long as you use the `type' attribute.
var s_height = screen.Height
var s_width = screen.Width

It's `screen.height' and `screen.width' (JavaScript is case-sensitive),
and it is still scriptkiddie crap since

Display resolution != desktop size != size of browser window != size
of browser viewport. [psf 3.7]

Drop the whole thing.
[...] is there antway of doing it

Yes, *not* doing it, because you do not need it with working markup anyway.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top