Last active
August 29, 2015 14:11
-
-
Save rodneyrehm/3a6c7357970d9b1d447c to your computer and use it in GitHub Desktop.
IE11 Bug: Favicon Request
This file contains hidden or 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
| <?php | |
| $logfile = '/tmp/ie-11-favicon.log'; | |
| if (empty($_GET['type'])) { | |
| $_GET['type'] = 'html'; | |
| } | |
| $headers = array( | |
| 'Request ' . $_GET['type'] . ' at ' . date('Y-m-d H:i:s'), | |
| ); | |
| if (!empty($_GET['src'])) { | |
| $headers[] = 'Source: ' . $_GET['src']; | |
| } | |
| foreach ($_SERVER as $key => $value) { | |
| if (substr($key, 0, 5) === 'HTTP_') { | |
| $headers[] = substr($key, 5) . ': ' . $value; | |
| } | |
| } | |
| if ($_GET['type'] !== 'log') { | |
| file_put_contents($logfile, join($headers, "\n") . "\n\n", FILE_APPEND); | |
| } | |
| switch ($_GET['type']) { | |
| case 'ico': | |
| header('Content-Type: image/x-icon'); | |
| echo base64_decode('AAABAAEAEBAAAAAAAABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAC/v78AWFhYAElJSQA6OjoAKysrABwcHAC9vb0AVlZWACkpKQCBgYEAGhoaAAsLCwCsrKwARUVFADY2NgD19fUAJycnAH9/fwAYGBgAcHBwAAkJCQBhYWEAubm5AFJSUgDz8/MANDQ0ACUlJQB9fX0AFhYWAG5ubgAHBwcAX19fALe3twBQUFAAQUFBACMjIwAUFBQAXV1dAE5OTgCmpqYAPz8/AP7+/gAwMDAAISEhABISEgBqamoAW1tbAExMTAA9PT0ALi4uAB8fHwDe3t4Ad3d'); | |
| exit; | |
| case 'png': | |
| header('Content-Type: image/png'); | |
| echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII='); | |
| exit; | |
| case 'gif': | |
| header('Content-Type: image/gif'); | |
| echo base64_decode('R0lGODlhAQABAAAAACwAAAAAAQABAAA='); | |
| exit; | |
| case 'log': | |
| header('Content-Type: text/plain;charset=UTF-8'); | |
| echo file_get_contents($logfile); | |
| exit; | |
| } | |
| ?><!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>favicon</title> | |
| <link rel="apple-touch-icon" href="<?php echo $_SERVER['SCRIPT_NAME']; ?>?type=png&src=rel-apple-touch-icon"> | |
| <link rel="icon" href="<?php echo $_SERVER['SCRIPT_NAME']; ?>?type=png&src=icon"> | |
| <!--[if IE]><link rel="shortcut icon" href="<?php echo $_SERVER['SCRIPT_NAME']; ?>?type=ico&src=shortcut-icon"><![endif]--> | |
| <!-- or, set /favicon.ico for IE10 win --> | |
| <meta name="msapplication-TileColor" content="#D83434"> | |
| <meta name="msapplication-TileImage" content="<?php echo $_SERVER['SCRIPT_NAME']; ?>?type=png&src=msapplication-title"> | |
| </head> | |
| <body> | |
| <a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>?type=log">to the log</a> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment