Skip to content

Instantly share code, notes, and snippets.

@karlcow
Created January 30, 2012 19:09
Show Gist options
  • Save karlcow/1706037 to your computer and use it in GitHub Desktop.
Save karlcow/1706037 to your computer and use it in GitHub Desktop.
Linux OR Opera excluded - bad user agent sniffing
On http://map.hackerwatch.org/hwmap/javascript/main.js
// Determine browser type and platform.
if (navigator.appName.indexOf("Netscape")>=0) {
m_sClientBrowserType = 'Netscape';
} else if (navigator.appName.indexOf('Microsoft') >=0) {
m_sClientBrowserType = 'IE';
} else {
window.location = "unsupported.htm";
}
if (navigator.userAgent.indexOf("Win") >= 0) {
m_sClientPlatform = 'Windows';
} else if (navigator.platform.indexOf("Mac") >= 0) {
m_sClientPlatform = 'Mac';
} else {
window.location = "unsupported.htm";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment