Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
How to redirect the current page to a new page in **IE11** ?

This is what I have got so far, but it didn't work.

<!--[if IE]>
<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.domain.com">
<![endif]-->

------

This htaccess IE11 redirect doesnt work either-->

XML
RewriteEngine on

RewriteCond %{HTTP_USER_AGENT} IE11 [NC]
RewriteRule ^ http://google.com/ [L,R]


------

This is the user agent of IE11, so I need to redirect visitors with these user agents-->

Mozilla/5.0 (IE 11.0; Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C; rv:11.0) like Gecko

How do I redirect IE11 visitors? Any ideas?

What I have tried:

I've tried above code, but IE11 visitors continue to the same site instead of being redirected to the chosen domain. :(
Posted
Updated 6-Jul-16 1:28am
v3
Comments
Suvendu Shekhar Giri 5-Jul-16 1:30am    
Before we suggest something, it would be great to understand your requirement so that we may be able to suggest something better. Why only IE11 and not just IE?

1 solution

You may be surprised but user agent string can be faked easily, so a browser can impost any other browser...
For that reason you should not differentiate your site based on browser detection, but based on feature detection...
For instance do no say I support only Chrome and FF, but say I support only browser compiles to standard and has addEventListener method...
This approach will open your site for future/updated browsers without any change or any concern about, how the browser called or identify itself...
It also enables you to create different solution for different browsers with ease...

For an easy path you may use Modernizr: the feature detection library for HTML5/CSS3[^]

JavaScript
if ( Modernizr.canvas ) { // browser supports canvas
    drawCanvas();
} else {
    // relocate to an error page
    // or
    drawImageFromServer();
}
 
Share this answer
 
Comments
Maciej Los 7-Jul-16 1:55am    
5ed!
Kornfeld Eliyahu Peter 7-Jul-16 3:29am    
Thank you!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900