0

I am a student and need to be logged into a website that keeps logging me out, due to inactivity after 30 minutes or so. I've tried to prevent the code from logging me out with extensions like "Session Keeper" "staying alive" "Stay Forever" and some small scripts on tampermonkey. But it doesn't seem to work.

I am not very skilled in coding, so I have no idea what to look for and what to do about it. But I have made a few scripts in tampermonkey before, and I hope to use it again to solve this issue as well. But I don't know where to start. Any idea what I can do?

VLAZ
  • 26,331
  • 9
  • 49
  • 67

1 Answers1

0

Inactivity is usually when you do not interact with the website, typically meaning either loading pages or clicking on links/elements.

A way to automatically interact with the website is to reload the page you are on with a set interval that is less than the 30 minutes you mention - note: it's usually 20 minutes.

You could use TamperMonkey or an extension like "User JavaScript and CSS" ( https://chrome.google.com/webstore/detail/user-javascript-and-css/nbhcbdghjpllgmfilhnhkllmkecfmpld ) and inject a small piece of JavaScript code:

var numberOfMinutes = 10;

setTimeout( () => {
    // Your code here - will be executed after 10 minutes
}, 1000 * 60 * numberOfMinutes );

The code you inject could be to reload the page or click an element.

Reload Page:

location.reload();

Click an element:

document.querySelector("#myelement").click()