Skip to content

Instantly share code, notes, and snippets.

@DanAntFerrari
Last active December 19, 2015 07:09
Show Gist options
  • Save DanAntFerrari/5917198 to your computer and use it in GitHub Desktop.
Save DanAntFerrari/5917198 to your computer and use it in GitHub Desktop.
Online CSS templating debug
var mystyle="http://localhost/x/css/style.css";
function test() {
var CSShold = document.getElementById('DevCSS');
if (CSShold){
//console.log('if');
document.getElementsByTagName('head')[0].removeChild(CSShold)
}/*else{
//console.log('else');
}*/
var d=new Date(),
t=d.toLocaleTimeString(),
nocahe=d.toLocaleTimeString(),
DevCSSTag=document.createElement('link');
DevCSSTag.href = mystyle+'?version='+t;
DevCSSTag.id="DevCSS";
DevCSSTag.type = "text/css";
DevCSSTag.rel = "stylesheet";
DevCSSTag.media = "screen, projection";
document.getElementsByTagName('head')[0].appendChild(DevCSSTag);
console.log('aggiornato: '+t);
} // test();
var interval =setInterval(function(){test()},8000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment