GustavBylund
+46 (0)73 026 26 86hello@gustavbylund.semaisthoRefresh a page every 30 seconds
Refreshing a page on a interval is sometimes very useful. This will work on most pages, but if it doesn’t, you will need a browser extension in order to auto refresh that page.
Bookmarklet
Drag the following link to your bookmark bar!
Refresh 30sDon’t click the button twice, or the site breaks. Nested iframes are probably not allowed by browsers.
Or add this code to a bookmark:
javascript:(a=>{a(),setInterval(a,3e4)})((b=document)=>{b.write(`<iframe src="${location}" style="position:absolute;top:0;left:0;width:100%;height:100%;border:0"/>`),b.close()});
How it works:
It creates an iframe on the same page and reloads it every 30 seconds
let refresh = () => {
document.write(`<iframe src="${location}" style="position:absolute;top:0;left:0;width:100%;height:100%;border:0"/>`)
document.close()
}
refresh()
setInterval(refresh, 30000)
Codegolfed
let r = (d = document) => {
d.write(`<iframe src="${location}" style="position:absolute;top:0;left:0;width:100%;height:100%;border:0"/>`)
d.close()
}
x()
setInterval(x, 3e4)
Golfed + Minified
After minification it’s only 167B. Please let me know if you can do it in less without modifying global scope!
(a=>{a(),setInterval(a,3e4)})((b=document)=>{b.write(`<iframe src="${location}" style="position:absolute;top:0;left:0;width:100%;height:100%;border:0"/>`),b.close()});