Notes/static/js/lib/css_reload.js

11 lines
312 B
JavaScript
Raw Normal View History

2023-06-15 07:24:23 +02:00
function refreshCSS() {
let links = document.getElementsByTagName('link')
Array.from(links).forEach(l=>{
if (l.rel == 'stylesheet' && !l.hasAttribute('x-no-reload')) {
let cache = Math.floor(Math.random()*100000)
l.href = l.href.replace(/\?.*/, '') + `?cache=${cache}`
console.log(l.href)
}
})
}