detecting screen res in netscrape

Discussion in 'Javascript' started by Andy, Dec 7, 2003.

  1. Andy

    Andy Guest

    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
     
    Andy, Dec 7, 2003
    #1
    1. Advertising

  2. "Andy" <andy@jarrow_online.com> schreef in bericht
    news:bquulc$233$...
    > 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
     
    Janwillem Borleffs, Dec 7, 2003
    #2
    1. Advertising

  3. Andy

    Keith Bowes Guest

    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.
     
    Keith Bowes, Dec 7, 2003
    #3
  4. 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
    d (replace ".invalid" with ".uk")
     
    Michael Winter, Dec 7, 2003
    #4
  5. 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
     
    Stephen Poley, Dec 7, 2003
    #5
  6. 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
     
    Thomas 'PointedEars' Lahn, Dec 8, 2003
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    6
    Views:
    14,618
    Darryl L. Pierce
    Jan 1, 2006
  2. null7
    Replies:
    3
    Views:
    4,895
    Raymond DeCampo
    Jan 29, 2006
  3. Nik Coughin

    res:// protocol

    Nik Coughin, Jan 10, 2004, in forum: HTML
    Replies:
    6
    Views:
    5,053
    Nik Coughin
    Jan 12, 2004
  4. Leiradella, Andre V Matos Da Cunha

    RES: RES: Bare-bones Ruby

    Leiradella, Andre V Matos Da Cunha, Dec 29, 2004, in forum: Ruby
    Replies:
    1
    Views:
    307
    Stefan Schmiedl
    Dec 29, 2004
  5. Leiradella, Andre V Matos Da Cunha

    RES: RES: RES: Bare-bones Ruby

    Leiradella, Andre V Matos Da Cunha, Dec 29, 2004, in forum: Ruby
    Replies:
    0
    Views:
    137
    Leiradella, Andre V Matos Da Cunha
    Dec 29, 2004
Loading...

Share This Page