Click to See Complete Forum and Search --> : location.replace works in IE but not Mozilla


Martin O
February 7th, 2006, 01:11 PM
I have the following html file:

<html>

<head>
</head>

<body>
<script>
location.replace('http://www.google.com');
</script>
</body>

</html>


When I open this in IE it works (it shows the google page).
When I open it in Mozilla 1.7.11 it doesn't work. The status bar says 'Connecting to www.google.com...', but it never opens & eventually says 'the operation timed out when attempting to connect to www.google.com'.

Does anyone know why this is? If I drag the htm file into mozilla it works, but if I right-click & choose open with->Mozilla, it doesnt work.

Thanks,
-Martin

PeejAvery
February 7th, 2006, 03:57 PM
Why do you use location.replace? Try...
<script language="JavaScript">
window.location = "http://www.google.com";
</script>

Dr. Script
February 7th, 2006, 05:52 PM
I think he wants to keep the page from being saved in history.
I don't think this is a Mozzila flaw as much as something with your computer. I suppose that if you try it again, you'll probably see it work as intended ...

PeejAvery
February 7th, 2006, 09:58 PM
I think he wants to keep the page from being saved in history.
Interesting...That is new to me. Live and learn.

Martin O
February 8th, 2006, 11:05 AM
Thanks for the replies peejavery & Doctor Script.
Your right doc, the same thing works on my computer at home. But at work it doesnt (I've tried many times). One difference is that at work I had to setup a proxy for mozilla (edit->preferences->advanced->proxies->automatic proxy configuration url). I don't think I had to at home.

I can access www.google.com on mozilla if I type it directly into the address field. And as I mentioned, it works if I drag the html file into mozilla instead of right clicking->open with->mozilla.

The wierd thing is, the location.replace works inside the program I'm working on, but when I take it out & make a small test program (the code I provided) it doesn't work. I thought that maybe there's some mozilla preference along the lines of 'let javascript redirect urls' or something. Along this line of thinking I thought that the program (huge program that I didn't write) has somewhere in it a way to set this preference I'm imagining exists, which is why it works in the program but not in my test html file.

Thanks for the help guys.