detecting screen res in netscrape

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andy

    detecting screen res in netscrape

    got the usual script:

    <script language="JavaS cript" type="text/JavaScript">
    var s_height = screen.Height
    var s_width = screen.Width
    var s_screen= screen.colorDep th

    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


  • Janwillem Borleffs

    #2
    Re: detecting screen res in netscrape


    "Andy" <andy@jarrow_on line.com> schreef in bericht
    news:bquulc$233 $1@news8.svr.po l.co.uk...[color=blue]
    > got the usual script:
    >
    > <script language="JavaS cript" type="text/JavaScript">[/color]

    The type should be lowercased: text/javascript
    [color=blue]
    > var s_height = screen.Height
    > var s_width = screen.Width[/color]

    These properties should be called lowercased also:

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


    JW



    Comment

    • Keith Bowes

      #3
      Re: detecting screen res in netscrape

      Janwillem Borleffs wrote:[color=blue][color=green]
      >><script language="JavaS cript" type="text/JavaScript">[/color]
      >
      >
      > The type should be lowercased: text/javascript
      >[/color]

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

      Comment

      • Michael Winter

        #4
        Re: detecting screen res in netscrape

        Keith Bowes wrote on 07 Dec 2003:
        [color=blue]
        > Janwillem Borleffs wrote:[color=green][color=darkred]
        >>><script language="JavaS cript" type="text/JavaScript">[/color]
        >>
        >> The type should be lowercased: text/javascript[/color]
        >
        > Why? The type is an HTML attribute, and hence is case insensitive.[/color]

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

        Mike

        --
        Michael Winter
        M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk")

        Comment

        • Stephen Poley

          #5
          Re: detecting screen res in netscrape

          On Sun, 7 Dec 2003 10:17:34 -0000, "Andy" <andy@jarrow_on line.com>
          wrote:
          [color=blue]
          >got the usual script:
          >
          ><script language="JavaS cript" type="text/JavaScript">
          >var s_height = screen.Height
          >var s_width = screen.Width
          >var s_screen= screen.colorDep th
          >
          >if ( s_height == "480" && s_width == "640" )
          >
          >{
          >window.locatio n = "bigframe/index.htm"
          >}
          >
          >else if[/color]
          ....

          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

          Comment

          • Thomas 'PointedEars' Lahn

            #6
            Re: detecting screen res in netscrape

            Andy wrote:
            [color=blue]
            > got the usual script:[/color]

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

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

            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]
            [color=blue]
            > [...][/color]

            Drop the whole thing.
            [color=blue]
            > [...] is there antway of doing it[/color]

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


            PointedEars

            Comment

            Working...