Дискусии » Разработка

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

§
Публикуван на: 26.09.2022

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.

§
Публикуван на: 27.09.2022

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.

§
Публикуван на: 27.09.2022

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...
})();

§
Публикуван на: 27.09.2022

I currently don't have time available for anything.

Публикувайте отговор

Влезте, за да публикувате отговор.