SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2003
    Location
    Germany
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Netscape 6 load a page problem

    Hi there,

    I am using a little work around to get the "inner width" before the actual page loads. This is done by a PHP file wich sets a session variable. It's no problem, if you don't "speak" PHP in this case.

    I call a js file which finds out the inner width. This js than loads a php file which does the job.

    Everything works fine in IE5+ but unfortunately not in NS6. NS4 doesn't need to be supported. Here is the code to call the file including teh width variable.

    Code:
    document.open();
    document.write("<script language=\"JavaScript\" type=\"text/javascript\" src=\"/includes/save_width.php?width="+w+"\"></script>");
    document.close();
    Any idea, why this doesn't work?

    Thanks for any ideas....

    Regards ASchweti

  2. #2
    SitePoint Member
    Join Date
    Aug 2003
    Location
    new york
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you are missing the part that set the "w" variable. Probably you are setting it with document.body.clientWidth, or document.body.offsetWidth, which would work ok for IE.

    but for netscape/mozilla, you need window.innerWidth.

    so to set w, you would need something like:

    var w = window.innerWidth ? window.innerWidth : document.body.offsetWidth ? document.body.offsetWidth : -1;

    or something like that...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •