Skip to content

Instantly share code, notes, and snippets.

@simshaun
Created September 28, 2018 18:17
Show Gist options
  • Save simshaun/c982001e4ac5f1d4aa5fe6dbe3d14a57 to your computer and use it in GitHub Desktop.
Save simshaun/c982001e4ac5f1d4aa5fe6dbe3d14a57 to your computer and use it in GitHub Desktop.
IE11 devtools - add/reload a stylesheet
var existingLink = document.querySelector('link[data-custom-css]');
if (existingLink) { existingLink.parentNode.removeChild(existingLink); }
var link = document.createElement('link');
link.setAttribute('data-custom-css', '1');
link.rel = 'stylesheet';
link.href = '/xxxxxxxxxxxxxxxxxxxxxxxx.css?'+Math.floor(Math.random()*10000);
document.querySelector('head').appendChild(link);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment