Log in

View Full Version : Detect Browser type and Display Text message



SayJumner
09-25-2007, 07:33 PM
I've been looking for a script that will detect a surfers browser type and version and display a text message with directions for a the browser type and version i say.

Twey
09-25-2007, 07:41 PM
It's impossible to do perfectly. You can best attempt it with Javascript:
<div id="instructions-opera" style="display: none;">
Instructions for Opera...
</div>
<div id="instructions-ie" style="display: none;">
Instructions for IE...
</div>
<div id="instructions-generic">
Generic instructions...
</div>

<script type="text/javascript">
var btype = "generic";
document.getElementById("instructions-" + btype).style.display = "none";

if(window.opera) btype = "opera";
else if(window.ActiveXObject) btype = "ie";

document.getElementById("instructions-" + btype).style.display = "block";
</script>

boogyman
09-25-2007, 07:41 PM
where would it be processed?
what language?

see this article (http://www.dynamicdrive.com/forums/showthread.php?t=24866) for the forum rules about posting

SayJumner
09-25-2007, 07:45 PM
I was hoping for JS

thetestingsite
09-25-2007, 07:46 PM
boogyman, this would be the right forum to post in being that there is no question about a particular scripting language, but instead they are looking for this specific service.