Forum Moderators: open

Message Too Old, No Replies

Setting up special code for Netscape Navigator

is it still necessary?

         

Lorel

9:45 pm on Feb 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Is it still necessary to set up special code for Netscape Navigator?

I redesign old sites and keep finding special code for Navigator, like the following, and just wondering if it's still necessary?

<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW ¦¦ innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>

On another site there is an index.cgi page (designed in 2001) that redirects all netscape and IE broswers (even the newest ones) to certain pages.

Is this still necessary also?

It seems to me this would be a javascript redirect which Google has banned. Yes?

encyclo

4:11 am on Feb 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, the first code is to avoid a resize bug in Netscape 4 - and NN4 is totally dead and buried now. For the other redirects, it is very bad practice and usually damaging in terms of functionality (and spiderablity) for search engine bots. You should look to removing all such code whenever possible, and using server-side redirects when required. What does the index.cgi do exactly? Usually it will be doing a server-side redirect, but probably a 302 or meta refresh rather than a 301.

rocknbil

7:38 pm on Feb 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is it still necessary to set up special code for Netscape Navigator?

I hope this doesn't derail your question - but I learned a trick long ago from the NN developer pages themselves which are no longer in existence.

It's a bad idea to take *any* action based on browser identification. This becomes a maintenance nightmare, one which reveals itself over time. Your example is a perfect demonstration.

If you need to do something that may work differently in various browsers and platforms, what you want to do is test for the object or functionality when the page is requested. For example,

if (document.getElementById) {
// do something with id'ed elements
}

So if you still have an old browser or even a text-only browser that does not handle document.getElementById, whatever goes on here will get completely ignored and will use your non-JS alternate. The good part is, until browsers no longer react to getElementById (probably 'never') this will always work regardless of browser or operating system.

That is, so long as whatever you put in the 'if' uses standards and not proprietary methods or references to proprietary objects.