Skip to content

Instantly share code, notes, and snippets.

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