How would i go about having my site know lets say "IE User Visit's" and my site goes oh there on IE pop up lightbox or something. needs to support html. but say there on Mozilla or safari base browsers it just goes it because radius is supported by them
A:
Using jQuery you could do something like this. (Not saying you should, but you could).
$(function() {
if ($.browser.msie) {
// You could insert your favorite lightbox script here.
alert("You're using IE");
}
});
jessegavin
2010-03-31 21:43:35
+1
A:
As jessegavin already mentioned, this isn't recommended. That said, the following javascript condition will check to see if the browser's user agent is described as 'msie.'
if ( navigator.userAgent.toLowerCase().indexOf("msie") > -1) {
$('#IEmessage').modal(); //or whatever
}
RedGlobe
2010-04-01 00:52:11
and that code alows me to make a script that can call an html page?
s32ialx
2010-04-01 01:08:26
why is it not recommended tho ?
s32ialx
2010-04-01 01:09:03
By "call and html page" do you mean use ajax to bring in an external page onto the current page or redirect to a different page (away from the current page)? Browser detection is usually considered bad practice because of two reasons. The first and more relevant reason is that trying to detect a browser is an indication that you're trying to solve a problem the wrong way. Basically, websites should be seen the same way across all browsers. The second issue people have (not me, so much) is that user agents (browsers) can be 'faked' or masked... thereby bypassing your script.
RedGlobe
2010-04-01 23:40:59