GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   is there a way to tell if a user is using IE or FF and... (https://gfy.com/showthread.php?t=581884)

Pete-KT 03-01-2006 07:12 PM

is there a way to tell if a user is using IE or FF and...
 
is there a way in an html to tell if the user is using ie or FF and if its FF to use a differnt part of code instead of using the code for ie?

JOKER 03-01-2006 07:13 PM

Yes, there is.

Pete-KT 03-01-2006 07:16 PM

Ok so how do i do it?

SmokeyTheBear 03-01-2006 07:16 PM

Code:

<script>
var browser_type=navigator.appName
var browser_version=parseInt(navigator.appVersion)

//if NS 6
if (browser_typehahahaha"Netscape"&&browser_version>=5){
document.write("your using netscape");
}
//if IE 4+
else if (browser_typehahahaha"Microsoft Internet Explorer"&&browser_version>=4){
document.write("your using ie");
}
//if firefox 1+
else if(navigator.userAgent.indexOf("Firefox") != -1){
document.write("Your using firefox");
}
//if NS4+
else if (browser_typehahahaha"Netscape"&&browser_version>=4)
{
document.write("Your using netscape");
}
//Default goto page (NOT NS 4+ and NOT IE 4+ or firefox)
else
{
document.write("i dunno what your using");
}
</script>


SmokeyTheBear 03-01-2006 07:18 PM

hmm stupid gfy parse out the = = ... ill try it again


<script>
var browser_type=navigator.appName
var browser_version=parseInt(navigator.appVersion)

//if NS 6
if (browser_type=="Netscape"&&browser_version>=5){
document.write("your using netscape");
}
//if IE 4+
else if (browser_type=="Microsoft Internet Explorer"&&browser_version>=4){
document.write("your using ie");
}
//if firefox 1+
else if(navigator.userAgent.indexOf("Firefox") != -1){
document.write("Your using firefox");
}
//if NS4+
else if (browser_type=="Netscape"&&browser_version>=4)
{
document.write("Your using netscape");
}
//Default goto page (NOT NS 4+ and NOT IE 4+ or firefox)
else
{
document.write("i dunno what your using");
}
</script>

JOKER 03-01-2006 07:19 PM

Quote:

Originally Posted by SmokeyTheBear
Code:

<script>
var browser_type=navigator.appName
var browser_version=parseInt(navigator.appVersion)

//if NS 6
if (browser_typehahahaha"Netscape"&&browser_version>=5){
document.write("your using netscape");
}
//if IE 4+
else if (browser_typehahahaha"Microsoft Internet Explorer"&&browser_version>=4){
document.write("your using ie");
}
//if firefox 1+
else if(navigator.userAgent.indexOf("Firefox") != -1){
document.write("Your using firefox");
}
//if NS4+
else if (browser_typehahahaha"Netscape"&&browser_version>=4)
{
document.write("Your using netscape");
}
//Default goto page (NOT NS 4+ and NOT IE 4+ or firefox)
else
{
document.write("i dunno what your using");
}
</script>



What he said, without the hahahaha :winkwink:

:thumbsup STB

Kevsh 03-01-2006 07:20 PM

Quote:

Originally Posted by Pete-KT
is there a way in an html to tell if the user is using ie or FF and if its FF to use a differnt part of code instead of using the code for ie?

In pure HTML?
Nope. You'll have to rely on JavaScript, etc. for the detection and it can update the tags parameters (visible/not visible).

eg. (in sort of a mashed pseudo-code)

<script>
IF browser = IE then one.visibility="visible"
ELSE two.visibility="visible"
</script>

<DIV ID="one" STYLE="visibility: hidden">
IE stuff here
</DIV>

<DIV ID="two" STYLE="visibility: hidden">
FF stuff here
</DIV>

I'd look up the exact elements/parameters but this is the basic idea, I did something like this a LONG time ago and it should still be viable.

czarina 03-01-2006 07:21 PM

you are quick on the draw smokey.

Kevsh 03-01-2006 07:22 PM

Edit: The advantage of this method is it's a little easier on the search engines and anyone having to read the code. And personally, I hate outputting HTML from a <script> tag :)

BigBen 03-01-2006 07:22 PM

http://sourceforge.net/projects/phpsniff/
http://us3.php.net/manual/en/function.get-browser.php

Libertine 03-01-2006 07:23 PM

Remember, though, that 5-10% of users have javascript disabled, so you also need some <noscript>content</noscript> if you use js for the output.

Theo 03-01-2006 07:34 PM

over 10 posts and nobody told you this is a newbie question ;-)


All times are GMT -7. The time now is 11:40 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123