Closed Thread Icon

Preserved Topic: browser compatability blues... (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8257" title="Pages that link to Preserved Topic: browser compatability blues... (Page 1 of 1)" rel="nofollow" >Preserved Topic: browser compatability blues... <span class="small">(Page 1 of 1)</span>\

 
jive
Paranoid (IV) Inmate

From: Greenville, SC, USA
Insane since: Jan 2002

posted posted 08-10-2002 19:45

I just set up a cool dhtml menu using Thomas Bratti's "slider menu", but something went wrong and now my page looks all wacked out on netscape 4-6. *sigh*. Is there a script out there that says : if netscape = go to this page, if ie, go to this page? That would probably make life a bit easier....

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 08-10-2002 21:18

well, i detect netscape with

if(document.layers {
...

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 08-10-2002 21:37

Here's mine:

code:
// Browser Detection Script copyright © Cameron T Owen, AKA Dracusis.
// Email cameron@NOSPAM.whatever.net.au

function userIs() {

// Inter-Function Pointers
d = document; n = navigator
a = n.userAgent.toLowerCase()

// General
this.dom = (d.getElementById)? 1:0 // Document Object Model
this.all = (d.all)? 1:0 // Document All (Internet Explorer)
this.lyr = (d.layers)? 1:0 // Document Layers (Netscape 4)
this.jav = (n.javaEnabled())? 1:0 // Java
this.cke = (d.cookie)? 1:0 // Cookies
this.img = (d.images)? 1:0 // Images

// Specific
this.aol = (a.indexOf('aol')!=-1)? 1:0 // AOL
this.op = (a.indexOf('opera')!=-1)? 1:0 // Opera
this.op4 = ((a.indexOf('opera 4')!=-1)&#0124; &#0124;(a.indexOf('opera/4')!=-1))? 1:0 // ^4
this.op5 = ((a.indexOf('opera 5')!=-1)&#0124; &#0124;(a.indexOf('opera/5')!=-1))? 1:0 // ^5
this.op6 = ((a.indexOf('opera 6')!=-1)&#0124; &#0124;(a.indexOf('opera/6')!=-1))? 1:0 // ^6
this.op5up = (this.op && this.op5 &#0124; &#0124; this.op6 && !this.op3 && !this.op4)? 1:0 // Opera 5 & Up
this.op6up = (this.op && this.op6 && !this.op3 && !this.op4 && !this.op5) // Opera 6 & Up
this.ie = ((a.indexOf('msie')!=-1) && !this.op)? 1:0 // Internet Explorer
this.ie4 = ((a.indexOf('msie 4')!=-1) && this.ie)? 1:0 // ^4
this.ie5 = ((a.indexOf('msie 5')!=-1) && this.ie)? 1:0 // ^5
this.ie55 = ((a.indexOf('msie 5.5')!=-1) && this.ie)? 1:0 // ^5.5
this.ie6 = ((a.indexOf('msie 6')!=-1) && this.ie)? 1:0 // ^6
this.ie4up = (this.ie4 && !this.ie3)? 1:0 // ^4+
this.ie5up = (this.ie5 &#0124; &#0124; this.ie55 &#0124; &#0124; this.ie6 && !this.ie4 && !this.ie3)? 1:0 // ^5+
this.ie55up = (this.ie55 &#0124; &#0124; this.ie6 && !this.ie5 && !this.ie4 && !this.ie3)? 1:0 // ^5.5+
this.ie6up = (this.ie6 && !this.ie55 && !this.ie5 && !this.ie4 && !this.ie3)? 1:0 // ^6+
this.ns = ((a.indexOf('mozilla')!=-1) && !this.aol && !this.op && !this.ie)? 1:0 // Netscape
this.ns4 = (this.ns && d.layers && !this.dom)? 1:0 // ^4
this.ns6 = (this.ns && this.dom)? 1:0 // ^6 or Mozilla
return this
}



Then you create an object like:

user = new userIs()

then you can use:

if (user.ie4up) location = "blah.html"...
if (user.nn4) location = "blah.html"...
if (user.moz) location = "blah.html"...
if (user.op) location = "blah.html"...

and so on and so on.

But if you only want IE vrs NN and Mozilla then just use this:

location = (document.all)? "page1.html" : "page2.html"

Oh, and remember to strip out the spaces between each or operator "&#0124; &#0124;" as the UBB will add a space between them.

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 08-10-2002 22:00

just to be picky, i think the correct call would be:

if (user.ie4up) location.href = "blah.html"...


Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 08-10-2002 22:09

I'm fairly certain that just 'location =' works too. fairly...

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 08-10-2002 23:27

yes, i just tested it.
you are right, drac.
big sorry, man!

jive
Paranoid (IV) Inmate

From: Greenville, SC, USA
Insane since: Jan 2002

posted posted 08-11-2002 09:07

I'm afraid I'm a bit of a javascript newbie. I tried copying and pasting your script, but I just got one big comment. I don't know what to put where....


but here is what I do have

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Untitled</title>
<script>
d = document; n = navigator a = n.userAgent.toLowerCase()

this.dom = (d.getElementById)? 1:0
this.all = (d.all)? 1:0
this.lyr = (d.layers)? 1:0
this.jav = (n.javaEnabled())? 1:0
this.cke = (d.cookie)? 1:0
this.img = (d.images)? 1:0

this.aol = (a.indexOf('aol')!=-1)? 1:0
this.op = (a.indexOf('opera')!=-1)? 1:0
this.op4 = ((a.indexOf('opera 4')!=-1)

Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 08-11-2002 12:09

you sure that when you copied and pasted drac's script you didn't paste it as one long line?

Windows has a tendency to paste stuff you copy as one long line. This causes a problem because the '//'s in the script define everything that follows on the same line as a comment- and if you're pasting everything as one line...

{edit} duh... I totally missed the obvious...
on YOUR script, you end the function like this:

--------------------------------------
return this
}
--------------------------------------

but where did you begin it?

btw, what's the JS error you're getting?


Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

[This message has been edited by Petskull (edited 08-11-2002).]

« BackwardsOnwards »

Show Forum Drop Down Menu