Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do I detect browser 2

Status
Not open for further replies.

niblet

Programmer
Aug 7, 2001
30
US

My page in IE Explorer is just what I want, but looks really bad in Netscape. I have rewritten it to work in both of them, but I don't like it half as much, from what I understand most people us IE. I would like to still load the page I like into the IE browswer and the lesser page only into netscape. Does anyone out there know how if I can detect if I have netscape and load the page that's right for netscape?

I appreciate the help

niblet
 
If I understand it right, you want a NS page to load if the user is using netscrap, and load an IE page if the user is using internet explorer, right??
Then this will take care of the problem...

<SCRIPT>
if(navigator.appName==&quot;Netscape&quot;)
location=&quot;else
location=&quot;</SCRIPT>

This will open one page if the user has netcrap and another page if they use explorer...
Laterz... I have not failed; I merely found 100,000 different ways of not succeding...
 
you could also use this more complex code... but heck the one GUJUmOdel is good enough....

here it goes anyway

Create a Re-direct page such as this.......

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>

<!-- this script re-directs users with a Netscape browser to a page they can use other wise it opens in Iexplorer -->
<!-- Replace the URLs below to target your customized pages -->


var name = navigator.appName
if (name == &quot;Microsoft Internet Explorer&quot;)
url=(&quot;else
url=(&quot;window.location=url;
</SCRIPT>
</body>
</html>

Good Luck....

Dumboy.! Ouch.! .my brain.....
spiderdesign@yahoo.com

It's hard to think with only one neuron......Ouch.....!....it hurts when I think......!
 
why not use the browser sniff behaviour in dW.

Windows
Behaviours
Press the + button.
Set up the browser sniff stuff
make sure the behaviour is set to &quot;onload&quot;

Make your first page empty. PLace the browser sniff in it. Make two other pages containing your proper stuff, then redirect according to the sniff. This way, your surfer doesn't have to wait till the whole page loads before they are sniffed and redirected.
 
Hello niblet!

I think nippi gives you the best suggestion - use DW's built-in behaviour.

The only thing: you don't need to make your first page empty and create two pages for IE and NN. You may create first page that is OK in IE and put DW's behaviour into this page to redirect user with NN.

Good Luck!
 
If your first page is empty, then the redirect will happen seamlessly and quickly if set to happen &quot;onload&quot;.

What happens if you don't have an empty first page?

Say your first page is 120k in size and the surfer is surfing on 56.6k using netscrap and a Mac? Mac netscrap seems to be even slower than PC Netscrap, so they could sit there for 30 seconds waiting for the whole page to load. Then after is has fully loaded, they will be redirected to another page which they will habve to watch load for 30 seconds.

Not having an empty first page is the easiest way to piss people off.

 
Hello nippi!

You're absolutely right! I gave just a general suggestion and we always have different ways to solve something. Anyway, we suggested to niblet different ways and he's free to choose what is the most suitable for his situation.

Good Luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top