Browser detection

Status
Not open for further replies.

Weasel

👄 I'd intercept me
Nov 25, 2011
4,135
2,461
Hi,

So I am here with another question, and I have been looking al over the internet to find the right code.

So this is what I want: I need a script, that only shows if you are NOT on chrome, safari or firefox. I know it's possible... but I can't find any good (or working) script.

Hope you guys can help me out.
 

tyr0ne

Active Member
Mar 29, 2012
141
14
It takes 3 seconds to do a research and another 3 to copy/paste the code..

Code:
<script>
 
document.write("User-agent header sent: " + navigator.userAgent);
 
</script>

This writes what user agent the visitor has, but you can always change the code to match your needs, example:


Code:
<script>
var UA = navigator.userAgent;
 
if( UA.indexOf("Firefox") == -1 && UA.indexOf("Chrome") == -1 && UA.indexOf("Safari") == -1) {
    execute code here
}
 
</script>

I'm sure there is other ways, but that's a pretty easy one if you don't already use jquery and don't want to implement it only for this.
 
Status
Not open for further replies.

Users who are viewing this thread

Top