Script to check weither person is using FireFox or IE

Join Discord

Detritus

Golden Oldie
Golden Oldie
Dec 11, 2003
671
0
122
Im creating a website using dreamweaver and on the 2 browzers things are in completely different places.

I was wondering if there was a script that could check what browzer people were using then forward them to the index.html made specifically for that browzer and if not they get send to the index.html for the other 1. Just an idea because it ****ing sucks that IE and firefox get different results from the same bloody thing
 

YoYoYo

Milo's Sex Slave
Golden Oldie
May 11, 2003
1,090
1
194
My house
Code:
<script>
<!-- Find browser -->
<!-- Created by FMG 2005 -->


function browser() {
var brow = navigator.userAgent.toLowerCase();
if (brow.indexOf("firefox") != -1) return 'Firefox';
if (brow.indexOf("msie") != -1) return 'InternetExplorer';
}

var browserName = browser();

if(browserName == "Firefox") document.write('FireFox only content');
else if (browserName == "InternetExplorer") document.write('InternetExplorer only content');
else document.write('Other browser only content');

</script>

where it says "document.write(" thats were you put your HTML, PHP, etc.. code it for the browser you want.

If you want the names of the other browsers just ask.

Enjoy :)



@Mastengjfdlkgubejgreh: Great help posting a site that dont even detect browser properly -_-. He wanted help coding it, not an example. Fool.

" » Browser Version :: You are using Netscape 5.0 (Windows; en-GB)"
Yes of course im using netscape :rolleyes:.
 
Last edited:

Dataforce

LOMCN VIP
VIP
Apr 15, 2003
2,080
0
283
Or, maybe, you could code your html better then you wouldn't need it.

What Firefox shows is more likely to be correct than what IE shows.
 

Atomicide

Golden Oldie
Golden Oldie
Jul 4, 2003
1,029
3
195
What Firefox shows is more likely to be correct than what IE shows.

i coded a forum skin, and it worked perfect in FF, but completely screwed in IE..

probably down to the browser parsing my code.

/ipix
 

Dataforce

LOMCN VIP
VIP
Apr 15, 2003
2,080
0
283
IE sucks.

http://home.dataforce.org.uk - html/css is nice and valid. FF displays it nicely, Opera displays it nicely, IE chokes on the <h3>'s (headers) and randomly displays parts of the headers in random places.