Navigation Lock for QuickConnect

Prevents backward and forward navigation on the QuickConnect domain to avoid unintended navigations.

  1. // ==UserScript==
  2. // @name Navigation Lock for QuickConnect
  3. // @namespace https://github.com/DennisGHUA/Navigation-Lock
  4. // @version 1.2.1
  5. // @description Prevents backward and forward navigation on the QuickConnect domain to avoid unintended navigations.
  6. // @match *://*.quickconnect.to/*
  7. // @grant none
  8. // @license MIT
  9. // @icon https://raw.githubusercontent.com/DennisGHUA/Navigation-Lock/refs/heads/main/Icon.png
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Anchor the user in the current page by setting the same state repeatedly.
  16. history.pushState(null, document.title, window.location.href);
  17. window.addEventListener('popstate', function(event) {
  18. history.pushState(null, document.title, window.location.href);
  19. });
  20.  
  21. // Prevent any unload or navigation attempts.
  22. window.addEventListener('beforeunload', (event) => {
  23. event.preventDefault();
  24. event.returnValue = '';
  25. });
  26.  
  27. })();