Welcome to WebmasterWorld Guest from 54.205.96.97

Forum Moderators: incrediBILL

location.replace not working in netscape

is my code ok?

   
8:59 pm on Nov 15, 2000 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am using the following to redirect some of my pages:

<SCRIPT language="JavaScript1.1">
                       <!--
                       location.replace("http://newurl.com/newpage.html");
                        file://-->
                     </SCRIPT>

placing it in the body of the page.

However this is not working with Netscape 4.6. (JS is turned on) Works fine in IE.

Is this just a NS problem?

Thanks for your help.
Ken

11:40 pm on Nov 15, 2000 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Hi drastic,

The final line:

file://-->
is not familiar js code to me. From what I see the script should end at the semicolon.

I'm also not sure that placing this code in the body of the page is a good idea -- either pacing it in the head or calling it from an external file leaves less room for problems.

You can get a clue about JavaScript problems from the Netscape javascript console. In the browser location bar, type javascript: (be sure to include the colon) You'll get a cryptic message that can help pinpoint the line any errors occur on and, at least roughly, what they are.

7:19 pm on Nov 16, 2000 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks tedster!

I removed the file: part and the spacing, and it is working fine now. I also placed it in the head.

One more question, since it is now in the head, can I also omit the comment code that prevents non-JS browsers from seeing it?

Thanks a bunch!
Ken

ps - thanks for the JS console tip, very helpful!!

7:45 pm on Nov 16, 2000 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I'm glad it's fixed, drastic. Javascript debugging can get you talking to the walls sometimes.

I always use the comment marks, even in the head. The little bit of file size that might be saved isn't worth it. There's lots of browsers out there besides NN and MSIE -- you can't test on them all, so it's best to stay with the best practice standard.

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month