Hello,
I would like to refresh/reload specific page every 10 minutes. like with ctrl+r shortcut.
I created global.js script in \users\username\appdata\roaming\min
with content:
if (window.location.hostname === "https://test.com/index.html" {
setTimeout(function(){
window.location.reload(1);
}, 600000);
}
But this doesn't work, any ideas?
Thanks
window.location.hostname will just give you the domain name (like "test.com"). If you want to check the entire URL, you would need to use window.location.toString() instead.
Also, your script would need to go in a userscripts folder: \users\username\appdata\roaming\min\userscripts.
Finally, make sure you have the userscripts option enabled (in preferences > additional features).
Yeah my global.js is located in \users\username\appdata\roaming\minuserscripts I made a mistake and provided wrong location.
userscript is enabled in preferences.
For test purpose I will use host:
if (window.location.hostname === "google.com" {
setTimeout(function(){
window.location.reload(1);
}, 5000);
}
When I am on google.com it doesn't refresh every 5 sec.
I miss a plugin that could auto refresh a given page at a given time. This is why I started to create script but maybe there is other easier way to achieve this?
For Google, the hostname is actually "www.google.com", and you're missing a ) at the end of the if statement - it should look like this:
if (window.location.hostname === "www.google.com") {
If I change those two things, it works correctly.
I think a userscript is the best way to do this, since we don't support extensions right now.
Works correctly, thanks. I still have problem with window.location.toString() but that probably just me and my silly mistakes :)
Maybe try opening the console (developer > inspect page > console), typing in window.location.toString(), and make sure it’s the same as what you’re using in your user script.
On Aug 29, 2019, at 3:47 AM, soctemp notifications@github.com wrote:
Works correctly, thanks. I still have problem with window.location.toString() but that probably just me and my silly mistakes :)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
https://github.com/h0ek/Min-WebBrowser-Autorefresh
You can add this to https://github.com/minbrowser/min/wiki/userscripts as example at the bottom of the page like suggestion says (if you want to, of course)
Thanks!
I think this can be closed.