Skip to content

Instantly share code, notes, and snippets.

@davidgarsan
Created July 14, 2017 06:40
Show Gist options
  • Save davidgarsan/b31f060916e4fe73690fdd591b1857c2 to your computer and use it in GitHub Desktop.
Save davidgarsan/b31f060916e4fe73690fdd591b1857c2 to your computer and use it in GitHub Desktop.
Fix for IE8 and IE9 base tag bug
<head>
<base href="/">
<!--[if IE]><script type="text/javascript">
// Fix for IE ignoring relative base tags.
// See http://stackoverflow.com/questions/3926197/html-base-tag-and-local-folder-path-with-internet-explorer
(function() {
var baseTag = document.getElementsByTagName('base')[0];
baseTag.href = baseTag.href;
})();
</script><![endif]-->
<!-- this relative css path include should now work -->
<link type="text/css" rel="stylesheet" href="css/site.css" media="screen, projection">
<!-- include your other css and javascript files here.. -->
</head>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment