PDA

View Full Version : [HTML] Pages loads based on browser.



XGhozt
01-15-2006, 01:34 PM
Does anyone know of an if/then script that will work in the following ways..

If the guest/user is veiwing a page useing IE then it loads one image.
Else if the user/guest is useing FF, then it loads a different image.

I know this is possible becuase of a mod on my site.. Where it shows an image to tell what browser people are useing.. But I cant see the code becuase I dont know where it is.. But thats not why I need it anyways..

Any ideas as to how to do this?


----------------------------------
Please guys keep this thread clean..
----------------------------------

Thanks in advanced.

kds
01-15-2006, 01:40 PM
You can try


if (!stripos($_SERVER['HTTP_user_AGENT'], 'Internet Explorer')) {
// display one image
}
if (!stripos($_SERVER['HTTP_user_AGENT'], 'Firefox')) {
// display other image
}
This only works with PHP5 though.
http://www.webmasterworld.com/forum88/10975.htm

XGhozt
01-15-2006, 01:44 PM
Ill do a test page before I use it.. Thanx. Ill post agian if it works or not.

NickF
01-15-2006, 01:50 PM
Oh thats a neat script, thx.

kds
01-15-2006, 02:02 PM
A simply did a google search, which Xghozt could have easily done.

saren
01-15-2006, 02:04 PM
Or you can just use javascript. But hey, why be simple?

Dr. Silence
01-15-2006, 02:20 PM
Or you can just use javascript. But hey, why be simple?

Exacly.

XGhozt
01-15-2006, 02:40 PM
Or you can just use javascript. But hey, why be simple?

Thats what I aked for origenally.. sorta..

laocoon
01-15-2006, 03:28 PM
javascript/php would be the way to go depending on what you have available to you. Also, you posted this in the wrong forum.... We have a Programming forum for this kinda stuff =p But I don't care... LOL

saren
01-15-2006, 04:37 PM
Since I have a feeling xghost is too stupid to even know how to write a simple snippet of JS for his uber****ty website I guess I'll spend all 10 seconds of writing it.



<SCRIPT LANGUAGE="JavaScript">

var name = navigator.appName;
var vers = navigator.appVersion;
vers = vers.substring(0,1);

if (name == "Microsoft Internet Explorer")
url="nameofpageforms";
else
url="nameofpageformozilla";
url += vers + ".html";
window.location=url;
// Or if you want to make a dynamic link instead of it being automatic
document.write('<A HREF="' + url + '">Enter</A>');

</script>


Very short, probably lacking most of the functionality that you want, but it should be a start for you, if you are a ubar h4xx0r.

MasterX
01-15-2006, 06:45 PM
dudes your goin way to out on this

this is the kind of thing i used to help permy to protect zero

<?php
if ($HTTP_USER_AGENT <> "%%%%BROWSER CODE%%%%")
{
ONE
}
elseif $HTTP_USER_AGENT <> "%%%%BROWSER CODE%%%%")
{
TWO
}
?>

EyeOfFire
01-17-2006, 05:39 AM
Hmm, I was expecting people to flame the absolute hell out of xghost in this thread. Guess I was proven wrong...