Skip to content

Instantly share code, notes, and snippets.

@gapurov
Created November 15, 2018 00:42
Show Gist options
  • Save gapurov/07c4821e99d28e25998d15a6ebcca20c to your computer and use it in GitHub Desktop.
Save gapurov/07c4821e99d28e25998d15a6ebcca20c to your computer and use it in GitHub Desktop.
refresh css v2 bookmarklet by Lea Verou
// 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