Created
January 19, 2021 15:42
-
-
Save schu/55a89e539a9e146ecee21110f3c7d7e2 to your computer and use it in GitHub Desktop.
Revisions
-
schu renamed this gist
Jan 19, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
schu created this gist
Jan 19, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ // ==UserScript== // @name Stay logged in // @version 1 // @grant none // @include https://www.example.com/* // ==/UserScript== function keepalive() { //console.log('Sending HTTP HEAD request to: ' + location.href); var req = new XMLHttpRequest(); req.open('HEAD', location.href); req.onreadystatechange = function() { if (req.readyState === XMLHttpRequest.DONE) { var status = req.status; if (status === 0 || (status >= 200 && status < 400)) { //console.log('Success: ' + status); } else { console.log('HTTP Error: ' + status); } } }; req.onerror = function() { console.log('Network Error: request failed'); }; req.send(); }; setInterval(keepalive, 10 * 60 * 1000);