Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Detect IE 11 or below
if (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) || (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false)) {
//is IE 11 or below
}
@neenjaw

This comment has been minimized.

Copy link

neenjaw commented Jun 23, 2018

Nice snippet, thanks!

@theproj3ct

This comment has been minimized.

Copy link

theproj3ct commented Feb 21, 2019

Works thanks

@koran2019

This comment has been minimized.

Copy link

koran2019 commented Sep 26, 2019

Not worked on IE with touchscreen. Modify to support touchscreens:

if (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) || preg_match('~Trident/7.0(; Touch)?; rv:11.0~',$_SERVER['HTTP_USER_AGENT'])) {
//is IE 11 or below
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.