bbparis — 2012-12-30T15:55:18-05:00 — #1
Hello My friends,
I know you are passing a nice holiday with your family and friends, so permit me to bother you with my question: How can I redirect visitors using Internet Explorer to a page web ? I hope it is possible to do it with htaccess, in the goal to redirect ALL visitors who visit any page on the website.
In fact, I have installed a wordpress website to a friend, and it works perfect on all the web browsers, but unfortunately not on Internet Explorer. The user should go to TOOLS option on IE, and change the navigation type from Quirks to Internet Explorer 9 to be able view the website properly.
Best regards to you all, and thanks in advance for your help!
pullo — 2012-12-30T16:49:21-05:00 — #2
There are many different things that can cause Quirks Mode, for example, having stuff before the doctype.
As a quick fix, try adding this to the head section of your document:
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
If this doesn't help, would it be possible for you to post a link to the site with a short description of the problem?
logic_earth — 2012-12-30T16:49:49-05:00 — #3
Um. the solution is to fix your web pages not to force IE users to fix your problem for you. If IE9 is going into quirks mode you have invalid code, invalid HTML, fix it.
bbparis — 2012-12-30T18:47:54-05:00 — #4
Thank you guys for your help, I will try to fix it with Pullo's solution, and get back to you. Regards!
pullo — 2013-01-05T08:05:39-05:00 — #5
Hi there, something like this should work:
if ( preg_match("/MSIE/",$_SERVER['HTTP_USER_AGENT']) )
There's a good discussion of this here: http://stackoverflow.com/questions/7637585/how-to-redirect-all-ie-users-to-a-new-page
picnictutorials — 2013-01-05T10:31:53-05:00 — #6
I put that edge line in my site a while back to text and it still kept going into quirks mode
picnictutorials — 2013-01-05T10:34:04-05:00 — #7
Number 6 http://www.visibilityinherit.com/code/target-ie.php
dstorey — 2013-01-15T14:54:46-05:00 — #8
bbparis: Did including the meta element fix your web site in IE? If not, you may want to look at makingsure you're using an HTML5 doctype: <!DOCTYPE html>. This will force later versions of IE into standards mode.
I want to reiterate that it is a very bad idea to force all versions of IE to redirect to a different page. While earlier versions of IE were behind the times due to a 5 year leave of absence, IE9, and especially IE10 are modern browsers. They should render your content as expected if you're following standards. They shouldn't require any extra effort to support on your part than other modern browsers. Redirecting all users of current and future versions of IE just harms the users that choose to use those browsers.
felgall — 2013-01-15T15:10:01-05:00 — #9
That would redirect anyone who has Firefox, Chrome, Safari or Opera set with a useragent containing MSIE to indexIE.html even though the browser is not Internet Explorer. All browsers can use a useragent that identifies them as Internet Explorer and many people have whatever browser they are using set that way to bypass all the stupid browser testing scripts in antiquated web pages that only allow you to visit the page using Internet Explorer.
Also it would not send anyone using Internet Explorer who has their useragent set to not contain MSIE to the indexNonIE.html page - Internet Explorer allows you to set the useragent to anything at all. It's a good place to advertise where your ad is unlikely to be blocked.
The only way to properly identify Internet Explorer is by using conditional comments either in HTML or in JScript - it can't be done on the server.
pullo — 2013-01-15T15:22:43-05:00 — #10
Yup, browser sniffing sucks, which brings us nicely back to @logic_earth ;'s point, that it would be better to fix the site in the first place.