...

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



peterinwa
09-29-2003, 05: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:

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

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

peterinwa
09-29-2003, 06: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(){
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!

peterinwa
09-29-2003, 06: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.

peterinwa
09-29-2003, 07:07 AM
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'

glenngv
09-29-2003, 12:07 PM
Can you post the code where the js error points to?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum