Thursday, March 28, 2024

Browser Page – Netscape

Use these to jump around or read it all…


[What Happened?]

[Why Would I Want This?]

[I Have To Create All Those Pages?]

[Okay, How Do I Do It?]

[The Script]

[About JavaScript]

[Getting It All To The Net]


     Hi, Netscape user. You are probably seeing this text in newspaper-type columns, right? I did it through a command called MULTICOL. I know you’re using Netscape because you wouldn’t see these columns in Explorer. You see, the MULTICOL command is a Netscape-only deal. If you had been using Explorer, you would be seeing a MARQUEE here. It’s an Explorer-only deal.




What Happened?

     You may have already seen what happened, but I’ll explain it anyway because I love to hear myself talk.

     You were sent to a certain page depending on what browser, and what browser version, you are using. It was done through a JavaScript written by a Senior Designer at Net Studios who calls himself
The Iceman. And he may very well be. I’ve
never personally met the guy. He has been nice enough to grant HTML Goodies permission to use it.




Why Would I Want This?

     I do and I do for you — and this is the thanks I get. *sob*

     The two powers that be — Netscape Navigator and MS Explorer, are having a bit of a tiff. They are in a fun game of one-up-manship. Each is trying to create a bigger and better mousetrap to basically
squoosh the other. In doing so, the browsers are moving further apart in terms of events (things they will do). That means that if you are using one browser and the page you’re visiting has stuff intended for the other browser, you get an error code, or a nasty message, or nothing. You can read a whole bunch of tips on how to get around some of these
differences in the tutorial All The Same.

     This little beauty of a JavaScript will save a lot of surfing headaches by solving the major problem of browser type right off the bat. If you wrote a page intended for Explorer use alone — bingo — your people go to the page you set up for Explorer. Same deal with Netscape.

     Where this little script actually outshines some of the other ones I’ve seen is that it not only takes into account the brand name, but also the version. You see, not only do events change between browsers, they also change from browser version to browser version. Go figure. This script will not only redirect on browser type, but also on version. Ba-da-bing.

Here are the versions this little deal supports:





Netscape
Explorer
4.01 W95
4.0b1 W95
3.0 W95
3.02 W95
2.01 W95
4.0b2 W95
2.0 W3.x





I Have To Create All Those Pages?

     Nah. I only made two. I just sent all the Explorer references to a page called msiepage.html and all the Netscape references to a page called nspage.html. But if you want to create all those pages, go ahead.




Okay, How Do I Do It?

     You’ll need at least three pages:


  • The page with the JavaScript
  • A page intended for Netscape users
  • A page intended for Explorer users

     If you really want, you could also create a text version of one of the pages in case the user has neither Netscape nor Explorer. You would make a link on the script page for those people to use. I have a link as well, but I just made it go to the Netscape version page. It’ll display in text-only browsers just as well as a
text-only page. Plus it’s less work. I’m a lazy, lazy man.




The Script

     The script is available to you in simple text. Even more, it’s available as a full HTML document. You can either copy and paste right onto a text processor or download the page straightaway. It’s ready to go.

     If you are setting up only two pages, as I have done, you could go ahead and name them msiepage.html and nspage.html, and you are good to go. All done.

     If you wish to change out the names for the different browsers, you’ll easily see where the names are in the script. The line to look for is:

parent.location.href=””

     You change the name within the quote marks.


Grab the Script by Clicking Here

You will want to right click to download this page as Explorer doesn’t always display text pages. It may run it like the JavaScript that it is.



About JavaScript

     Let me state again, before all the e-mail letters, that you must edit, or copy, JavaScript in a text editor without margins. Notepad or IBM and Simple Text MACs are the best for all this. If you attempt to edit this script in a text editor with margins, you will corrupt it, and it will not work. You’ll get errors galore. Just opening your margins to their widest point is not enough. Lose the margins all together.

     That’s one of the reasons I made it a full HTML document. So you could just download it and then right away upload it without having to play with it too much.



Getting It All To The Net

     Once you have the three pages ready to go, upload them all to the same directory in your Web server. Then make sure the hypertext links are all aimed at the JavaScript page. That page makes the decision of which page should display for the user.

     Good luck with this. It will save you and your visitors a whole lot of headaches in the long run.


Enjoy!


[What Happened?]

[Why Would I Want This?]

[I Have To Create All Those Pages?]

[Okay, How Do I Do It?]

[The Script]

[About JavaScript]

[Getting It All To The Net]

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Popular Articles

Featured