Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts

    top.location.reload() fails with Netscape 7.1

    My website is a calculator and with each calculation I rewrite the page to display the results of the calculation. When you change some user options, however, I reload the page. I do this because after changing these options I want to start all over, resetting all the default parameter values.

    The JS code I use for this is simply:

    top.location.reload()

    or it works the same using the file name:

    top.location.='index_burn.html'

    I use "top." because it is a frames page.

    This works fine with Internet Explorer, reloading the page with all the original parameter defaults and reflecting the new user option selections which were saved in a cookie. It does not work, however, with Netscape. The page appears to reload, but the new user option selection saved in the cookie has not taken affect.

    I can see what is happening -- the page is not being fully reloaded -- because after typing Shift and clicking on the Reload icon the page reloads properly.

    Also, I get Netscape JS error messages like:

    Error: Uncaught exception: Permission denied to get property HTMLDocument.write

    Any ideas what is causing this error message; what it means; and/or why the page is reloading properly?

    Thanks, Peter

  • #2
    Regular Coder
    Join Date
    Jul 2003
    Location
    Massachusetts
    Posts
    472
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can we please see the full sourcecode for the page?
    Moderator @ WebDeveloper.com
    Mentor @ WebXpertz.net

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts
    It's 1200 lines? I thought of including the relavent stuff, but I think it's simply what I wrote about. Hmm. I'll try to include some of it. Unless you really want it all!?!

    Here's the code that calls the reload:

    function setHeight(abc){saveCookie1s("FCNprevTotsCookie",0,X1s);
    saveCookie1s("CBprevTotsCookie",0,X1s); mH=abc; saveCBcookie(); top.location.reload()}

    Here's what calls that:

    function changeOptions(){
    O=parent.image.document.f1.options[parent.image.document.f1.options.selectedIndex].value;
    if (O==1){top.location.href='help_burn.html'}
    if (O==2){if (mC=="ca"){} else {parent.create.setCalorie("ca")}}
    if (O==3){if (mC=="kj"){} else {parent.create.setCalorie("kj")}}
    if (O==4){if (Sx==1){} else {Sx=1; parent.create.saveCBcookie(); makeImage()}}
    if (O==5){if (Sx==2){} else {Sx=2; parent.create.saveCBcookie(); makeImage()}}
    if (O==6){if (mH=="ft"){} else {parent.create.setHeight("ft")}}
    if (O==7){if (mH=="cm"){} else {parent.create.setHeight("cm")}}

    Here's what calls that:

    // User Options drop down menu
    c+="<tr><td align=center class='formfields'>";
    c+="<select name=options onChange='parent.create.changeOptions()' class='formfields'>";
    c+=o+'0>User Options';
    c+=o+'0>';
    c+=o+'1>INSTRUCTIONS';
    c+=o+'0>';
    c+=o+'0>CALCULATE:';
    if (mC=="ca"){c+=o+'2>- Calories*'} else {c+=o+'2>- Calories'}
    if (mC=="kj"){c+=o+'3>- Kilojoules*'} else {c+=o+'3>- Kilojoules'}
    c+=o+'0>';
    c+=o+'0>SEX:';
    if (Sx==1){c+=o+'4>- Male*'} else {c+=o+'4>- Male'}
    if (Sx==2){c+=o+'5>- Female*'} else {c+=o+'5>- Female'}
    c+=o+'0>';
    c+=o+'0>HEIGHT:';
    if (mH=="ft"){c+=o+'6>- Feet*'} else {c+=o+'6>- Feet'}
    if (mH=="cm"){c+=o+'7>- Centimeters*'} else {c+=o+'7>- Centimeters'}
    c+=o+'0>';

    I'm just not sure what to include?

    Thanks!

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Now I see that I don't even have to type Shift and click on the Reload icon; I can simply put my cursor in the URL address field and press the Enter key. It goes to/reloads the page properly will all the default parameter values and cookie settings.

    It just seems to require this manual step.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I saw it working in other code of mine and copied it. It seems to work fine in Netscape with:

    top.location.href='index_burn.html'

  • #6
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Can you post the code where the js error points to?
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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