Greasy Fork is available in English.

Обсуждения » Разработка

Dear Bro. How to have a page refresh after 10 sec that it has finished loading? Just once.

Dear Bro.

How to have a page refresh after 10 sec that it has finished loading? Just once.

setTimeout(function(){
location.reload();
},10000);

This will result in 1 refresh every 10 seconds, and I only need to refresh twice in total.
That is to say, the automatic refresh of an open page is once, followed by another 10 seconds later.

That script loads again every time the page is loaded, so it makes it run in a loop.
You need to create a local storage or local session variable and check the value, then erase that value every x seconds for example.
You could also instead check for that variable value using tampermonkey storage.

My bro. Could you help me to achieve complete script? Good man.

// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author hacker09
// @match http://*/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==

(function() {
'use strict';

// Your code here...
})();

I currently don't have time available for anything.

Ответить

Войдите, чтобы ответить.