I am using ruby on rails 3 for my site and am almost finished, the site is due to go live very soon (Monday) but I am having problems with IE7 compatability, so as a temporary measure I would like to have users redirected to a "404" esque page if they are using IE7, it will just have some basic info stating to try another browser for now until the issues are fixed
How would i go about this in rails 3? Has anyone done anything like this in the past? I dont want to get into the should I/shouldnt I support IE7, I am going to, just going to take a little longer than I thought
Any help on this appreciated
You could do a script to redirect:
<!--[if IE 7]>
<script type="text/javascript">
window.location = "http://www.google.com/";
</script>
<![endif]-->
Or a html:
<!--[if IE 7]>
<meta http-equiv="REFRESH" content="0;url=http://www.google.com/">
<![endif]-->
Or simply leave a message saying that this site don't support
If you are able to use jQuery, you can do a simple browser version test and then redirect to the appropriate page and set a cookie:
//IE 7 browser detection
if ($.browser.msie) {
var version = $.browser.version;
if (version == '7.0') {
var cookie = $.cookie('IE7');
if (cookie != 'set') {
$.cookie('IE7', 'set');
window.location = '404-url-string';
}
window.location = '404-url-string';
}
}
you will need to bring in the jquery cookie plugin as well to set the cookie. The '404-url-string' would be the pathname of the page you are directing to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With