Created
November 15, 2018 00:42
-
-
Save gapurov/07c4821e99d28e25998d15a6ebcca20c to your computer and use it in GitHub Desktop.
refresh css v2 bookmarklet by Lea Verou
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
// http://lea.verou.me/2018/09/refresh-css-bookmarklet-v2/ | |
{ | |
let $$ = (selector, root = document) => Array.from(root.querySelectorAll(selector)); | |
let refresh = (document) => { | |
for (let link of $$("link[rel=stylesheet][href]", document)) { | |
let href = new URL(link.href); | |
href.searchParams.set("forceReload", Date.now()); | |
link.href = href; | |
} | |
for (let iframe of $$("iframe", document)) { | |
iframe.contentDocument && refresh(iframe.contentDocument); | |
} | |
} | |
refresh(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment