-
-
Save abierbaum/4025235 to your computer and use it in GitHub Desktop.
Chrome Frame example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script > | |
// Check that we have a supported browser | |
(function() { | |
var ua = window.navigator.userAgent, | |
in_chrome = /chrome/i.test(ua), | |
in_chrome_frame = /chromeframe/i.test(ua), // Notice inChrome is true if inChromeFrame is | |
in_ie = /msie/i.test(ua), | |
is_webkit = /webkit/i.test(ua); | |
console.log('chrome:' + in_chrome + ' chromeframe:' + in_chrome_frame + | |
' ie:' + in_ie + ' webkit:' + is_webkit); | |
}()); | |
</script> | |
</head> | |
<body> | |
<div id='in_ie' style="display:none"> | |
<p>To run TACCS Mobile in Internet Explorer, you need to install a plugin.</p> | |
<p>Please install the <a href="http://www.google.com/chromeframe?quickenable=true">Chrome Frame plugin</a>.</p> | |
</div> | |
<div id="unsupported" style="display:none"> | |
<p>Your browser is not supported by TACCS Mobile.</p> | |
<p>We recommend using <a href="http://www.google.com/chrome">Google Chrome</a> for | |
maximum security and performance.</p> | |
</div> | |
<script> | |
(function() { | |
if (in_ie) { | |
document.getElementById('in_ie').style.display = 'block'; | |
} else { | |
document.getElementById('unsupported').style.display = 'block'; | |
} | |
}()); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="X-UA-Compatible" content="chrome=1"> | |
<script > | |
// Check that we have a supported browser | |
(function() { | |
var ua = window.navigator.userAgent, | |
in_chrome = /chrome/i.test(ua), | |
in_chrome_frame = /chromeframe/i.test(ua), // Notice inChrome is true if inChromeFrame is | |
in_ie = /msie/i.test(ua), | |
is_webkit = /webkit/i.test(ua); | |
console.log('chrome:' + in_chrome + ' chromeframe:' + in_chrome_frame + | |
' ie:' + in_ie + ' webkit:' + is_webkit); | |
if(!(is_webkit || in_chrome_frame)) { | |
console.log('redirecting for unsupported browser'); | |
window.location.href = window.location.href.replace('index.html', 'bad_browser.html'); | |
} | |
}()); | |
</script> | |
</head> | |
<body> | |
Browser is supported. | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import SimpleHTTPServer | |
import SocketServer | |
PORT = 8000 | |
if len(sys.argv) > 1: | |
PORT = int(sys.argv[1]) | |
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler | |
httpd = SocketServer.TCPServer(("", PORT), Handler) | |
print "serving at port", PORT | |
httpd.serve_forever() |
redirect: window.location.href = "other place"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See: http://bl.ocks.org/4025235