1

I'm having issues with IE 10, 9, 8 and below. (Tested with IE Tester). But my layout works on IE 11. I already have a page that recommends a user to upgrade their browser to IE 11 or use another browser. However, I don't have a code that redirects users to this recommendation page. I want to do it using PHP.

So, to sum it up:

What am I finding?: A PHP code that redirects users to a particular recommendation page.

kevintresuelo
  • 166
  • 11
  • 2
    All the retired folks (`55+`) with all that beautiful $$$ use IE 7-9. Why would you want to block them and lose out on some potential big dollars? ;-) – Funk Forty Niner May 29 '14 at 03:30
  • 1
    Because it is having conflict with my design, and already built about 75% of my design. If I were to redesign it, it will take me time. And, my site is targeting kids, and not folks. =) – kevintresuelo May 29 '14 at 03:32
  • That's a big 10-4 ;-) – Funk Forty Niner May 29 '14 at 03:34
  • 1
    Dont block them, use a different stylesheet http://stackoverflow.com/questions/13785587/if-ie-not-working, that un-hides a message or such. – Lawrence Cherone May 29 '14 at 03:35
  • Don't redirect. That will only infuriate those that *have* to use IE <=10 (lots of people sitting in cubicles) and confuse those that don't know any better. Also, while IE10 can still suck, if it's breaking your layout that bad, it's likely due to your layout--not IE 10. – DA. May 29 '14 at 03:35
  • 1
    I'm afraid most people using IE aren't going to install a new browser just to view your site. I get what you're trying to do, but you might be better off just having a crappy design . – Wesley Murch May 29 '14 at 03:36
  • @LozCheroneツ that can work but I'd suggest using JS to dynamically insert the content rather than always having hidden content on the page regardless if they are using IE or not. – DA. May 29 '14 at 03:36
  • @DA yeah, but will the browser support it, and the amount of extra IE5/6 AJAX code would increase page size anyways lol ;p – Lawrence Cherone May 29 '14 at 03:37

2 Answers2

4

If I did understood your question correctly,

Put this on the very top of your PHP file, this code will detect IE 10 and below, and redirect them to your recommendation page:

if(preg_match('/(?i)msie [1-9]/',$_SERVER['HTTP_USER_AGENT']))
{
    header( 'Location: recommendation.php' ) ;
}
KevinT.
  • 272
  • 6
  • 16
1

All user agents below 11 have MSIE in them. Can just do a simple check for that

if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
    // It's IE10 or earlier
}

See Microsoft's User Agent guide

Machavity
  • 30,841
  • 27
  • 92
  • 100