Skip to content

Instantly share code, notes, and snippets.

@coryschires
Created June 15, 2010 21:57
Show Gist options
  • Save coryschires/439804 to your computer and use it in GitHub Desktop.
Save coryschires/439804 to your computer and use it in GitHub Desktop.
browser redirect script
// note: this script depends on the jQuery browser plugin
// http://jquery.thewikies.com/browser/
// place this at the very top of application.js
// outside of the document ready block to ensue
// it loads and initiates redirect as quickly
// as possible.
var browser_redirect = function() {
var os_param = $.os.name === 'mac' ? '?os=mac' : '?os=win';
var bad_browsers = {
ie6: jQuery.browser.name == 'msie' && jQuery.browser.versionX < 7,
ff2: jQuery.browser.name == 'firefox' && jQuery.browser.versionX < 3,
safari3: jQuery.browser.name == 'safari' && jQuery.browser.versionX < 4
};
for (var b in bad_browsers) {
if (bad_browsers[b]) {
return window.location = "http://" + window.location.host + "/browser_redirect.html" + os_param
}
}
}();
@coryschires
Copy link
Author

Cody where it says window.location = put the URL for your redirect page

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