Created
December 3, 2019 16:44
-
-
Save pixelbart/7767456ef716f71384f88adf0d34ddde to your computer and use it in GitHub Desktop.
Prüft ob der aktuelle Browser der Internet Explorer ist.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Prüft ob der aktuelle Browser der Internet Explorer ist. | |
* | |
* @return boolean | |
*/ | |
function is_ie() { | |
if ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) { | |
$ua = htmlentities( $_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, 'UTF-8' ); | |
if ( preg_match( '~MSIE|Internet Explorer~i', $ua ) || ( strpos( $ua, 'Trident/7.0' ) !== false && strpos( $ua, 'rv:11.0' ) !== false ) ) { | |
return true; | |
} | |
} | |
return false; | |
} | |
// Usage | |
if ( is_ie() ) { | |
echo 'Internet Explorer entdeckt!'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment