This userscript automatically refreshes the Algeria visa website every 30 seconds to prevent session timeouts or logouts. It saves the current session ID and URL so that when the page refreshes or the user tries to navigate away, it restores the original session and URL.
This userscript automatically refreshes the Algeria visa website every 30 seconds to prevent session timeouts or logouts. It saves the current session ID and URL so that when the page refreshes or the user tries to navigate away, it restores the original session and URL.
This userscript automatically refreshes the Algeria visa website every 30 seconds to prevent session timeouts or logouts. It saves the current session ID and URL so that when the page refreshes or the user tries to navigate away, it restores the original session and URL.
This userscript automatically refreshes the Algeria visa website every 30 seconds to prevent session timeouts or logouts. It saves the current session ID and URL so that when the page refreshes or the user tries to navigate away, it restores the original session and URL.
// @name Auto Refresh Website without Navigation or Logout
// @description Automatically refreshes the website every 30 seconds and prevents navigation/logout // @version 1.0 // @match https://algeria.blsspainvisa.com/* // @grant none // ==/UserScript==
(function() { 'use strict';
// Save the current session ID
var sessionID = '';
// Save the current URL
var currentURL = window.location.href;
// Get the session ID from the cookie
function getSessionID() { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = cookies[i].trim(); if (cookie.startsWith('PHPSESSID=')) { sessionID = cookie; break; } } }
// Auto refresh every 30 seconds
setInterval(function() { // Get the session ID if it hasn't been obtained yet if (sessionID === '') { getSessionID(); }
// Restore the session ID
document.cookie = sessionID;
// Check if the current URL has changed
if (window.location.href !== currentURL) { // Redirect back to the original page window.location.href = currentURL; } else { // Refresh the page location.reload(); } }, 30000); })();