View Full Version : top.location.reload() fails with Netscape 7.1

09-29-2003, 04:43 AM
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:


or it works the same using the file name:


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

09-29-2003, 04:53 AM
Can we please see the full sourcecode for the page?

09-29-2003, 05:00 AM
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(){
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';
if (mC=="ca"){c+=o+'2>- Calories*'} else {c+=o+'2>- Calories'}
if (mC=="kj"){c+=o+'3>- Kilojoules*'} else {c+=o+'3>- Kilojoules'}
if (Sx==1){c+=o+'4>- Male*'} else {c+=o+'4>- Male'}
if (Sx==2){c+=o+'5>- Female*'} else {c+=o+'5>- Female'}
if (mH=="ft"){c+=o+'6>- Feet*'} else {c+=o+'6>- Feet'}
if (mH=="cm"){c+=o+'7>- Centimeters*'} else {c+=o+'7>- Centimeters'}

I'm just not sure what to include?


09-29-2003, 05:04 AM
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.

09-29-2003, 06:07 AM
I saw it working in other code of mine and copied it. It seems to work fine in Netscape with:


09-29-2003, 11:07 AM
Can you post the code where the js error points to?