Skip to content

Instantly share code, notes, and snippets.

@EtherTyper
Created December 19, 2015 22:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EtherTyper/f2e5d6cfa5946cb48977 to your computer and use it in GitHub Desktop.
Save EtherTyper/f2e5d6cfa5946cb48977 to your computer and use it in GitHub Desktop.
IE discrimination template [For Larry]
<!-- BrowserCheck credit Michael Bleidistel !-->
<!-- Example (C) Eli Bradley, MIT License !-->
<!DOCTYPE html>
<html>
<body>
<h1>Not My First Web Page</h1>
<p id="demo">My first paragraph tho.</p> <!-- Replaced !-->
<script>
function BrowserCheck() //Returns an array of [name,number]
{
var N= navigator.appName, ua= navigator.userAgent, tem;
var M= ua.match(/(opera|chrome|safari|firefox|msie|trident)\/?\s*(\.?\d+(\.\d+)*)/i);
if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) {M[2]=tem[1];}
M= M? [M[1], M[2]]: [N, navigator.appVersion,'-?'];
return M;
}
document.getElementById("demo").innerHTML = (BrowserCheck()[0]+" "+BrowserCheck()[1]); //returns name and number
</script>
</body>
</html>
@EtherTyper
Copy link
Author

You're welcome, Larry!

Now get down to frustrating those MSIE 5.0 users!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment