View Full Version : Browser Redirect

03-03-2003, 12:24 AM
This is what I use to detect what browser the user is using, and opening up a page that is designed for that specific browser:


var name = navigator.appName
if (name == "Microsoft Internet Explorer")
window.open('index.htm','Max','width=795, height=440, toolbar=no, status=no, scrollbars=no, top=1, left=1, resize=no')


window.open('nets/index.htm','Max','width=800, height=440, toolbar=no, status=no, scrollbars=no, top=1, left=1, resize=no')


Of course, the window size and attributes can be adjusted to your own needs!

03-03-2003, 04:57 AM
Of course, you could also just write cross-browser code, and not worry about it.

03-03-2003, 05:03 AM
Yeah, i've always wondered about that, but it's hard to do that. Any tips on cross browser coding? I have trouble with tables and frames when I try to code for both major browsers.

03-03-2003, 09:07 AM
Have you tried XHTML. That is what it is designed for.


03-03-2003, 06:58 PM
XHTML...any suggestions on where to start learning XHTML?

03-03-2003, 07:46 PM
The quickest way is to pick up a book. I use XHTML Black Book from Coriolis. It seems to cover just about everything.

XHTML is really not that much different than HTML. It is just a more strict format. It does let get to a few more advanced features too. The book lets you know which commands work in IE compared to NS, etc. But to actually be XHTML the commands need to work in all browsers.

Most of the differences are minor stuff, for example:

You can use:

<img src="buttons/forms aqua - btn.gif" border=0 width=150 height=27>

And it would work in most browsers, but to be XHTML it should be:

<img src="buttons/forms aqua - btn.gif" alt="" name="p25" border="0" width="150"
height="27" />

Differences, you must include the NAME, you must include an ALT pic, all values must be in quotes, and you must terminate the statement (with a /).

It sounds like a pain in the butt, but once you get it down it makes your code a lot cleaner and a lot more coss compatible.

XHTML is not perfect either though. There are still some things that don't work in all browsers. This is just part of the vendor wars and you have to find a work around.

Did that help, or did I get to wordy?


03-03-2003, 07:50 PM
Thanks! I pretty well got it, but I don't understand how this can make it more cross browser compatible? I always use quotes anyway, and alt tags....???

03-03-2003, 08:27 PM
Ahhhh...you are one of the good peoples... I do like it when people have clean code.

A book that covers XHTML will show you how to do things with code that works in (supposedly) all browsers. It's not some huge revelation, it's just the way to get things done and have it work for everyone.


03-03-2003, 08:28 PM
After all....XHTML means extended HTML....