homepage Welcome to WebmasterWorld Guest from 54.237.95.6
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
location.replace not working in netscape
is my code ok?
Drastic




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

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

 

tedster




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

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.

Drastic




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

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!!

tedster




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved