Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > detecting screen res in netscrape

Reply
Thread Tools

detecting screen res in netscrape

 
 
Andy
Guest
Posts: n/a
 
      12-07-2003
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


 
Reply With Quote
 
 
 
 
Janwillem Borleffs
Guest
Posts: n/a
 
      12-07-2003

"Andy" <andy@jarrow_online.com> schreef in bericht
news:bquulc$233$(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
 
Keith Bowes
Guest
Posts: n/a
 
      12-07-2003
Janwillem Borleffs wrote:
>><script language="JavaScript" type="text/JavaScript">

>
>
> The type should be lowercased: text/javascript
>


Why? The type is an HTML attribute, and hence is case insensitive.

 
Reply With Quote
 
Michael Winter
Guest
Posts: n/a
 
      12-07-2003
Keith Bowes wrote on 07 Dec 2003:

> Janwillem Borleffs wrote:
>>><script language="JavaScript" type="text/JavaScript">

>>
>> The type should be lowercased: text/javascript

>
> 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

--
Michael Winter
http://www.velocityreviews.com/forums/(E-Mail Removed)d (replace ".invalid" with ".uk")
 
Reply With Quote
 
Stephen Poley
Guest
Posts: n/a
 
      12-07-2003
On Sun, 7 Dec 2003 10:17:34 -0000, "Andy" <andy@jarrow_online.com>
wrote:

>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.

--
Stephen Poley
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      12-08-2003
Andy wrote:

> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is hi-res + shrink better than taking lo-res? veg_all@yahoo.com Digital Photography 15 02-02-2007 08:30 AM
Screen res and function keys Ian H Computer Support 2 10-18-2006 10:58 PM
NetScrape 7.2 problems Robert Baer Computer Information 1 02-27-2005 02:55 AM
RES: RES: RES: Bare-bones Ruby Leiradella, Andre V Matos Da Cunha Ruby 0 12-29-2004 06:27 PM
RES: RES: Bare-bones Ruby Leiradella, Andre V Matos Da Cunha Ruby 1 12-29-2004 01:45 PM



Advertisments