Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
scroll problems
#12
I think I found it, I have a script in tampermonkey to disable all these annoying "close this page" popups,
here's the code:
Code:
// ==UserScript==
// @name kill_beforeunload
// @namespace Violentmonkey Scripts
// @include     *
// @grant none
// @run-at document-start
// ==/UserScript==
//

EventTarget.prototype.addEventListenerBase = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(type, listener)
    {
      if(type=="beforeunload") {
          return; //ignore attempts to add a beforeunload event
      }
      this.addEventListenerBase(type, listener); //treat all other events normally
};

function unsetOnBeforeUnload() {

    window.onbeforeunload = function(event) {};

    setTimeout(unsetOnBeforeUnload, 300); //optional, but some pages might set the event later in the page's lifecycle

}

document.addEventListener("DOMContentLoaded", unsetOnBeforeUnload);

I disabled it for youtube and now scrolling works when I switch to new comments for example,
which was impossible to work without that
Reply


Messages In This Thread
scroll problems - by patrickdrd - 04-16-2019, 10:28 AM
RE: scroll problems - by Admini - 04-17-2019, 04:09 PM
RE: scroll problems - by patrickdrd - 04-18-2019, 01:49 PM
RE: scroll problems - by patrickdrd - 04-22-2019, 11:13 AM
RE: scroll problems - by Admini - 04-22-2019, 03:40 PM
RE: scroll problems - by patrickdrd - 04-22-2019, 02:34 PM
RE: scroll problems - by rock888 - 04-22-2019, 03:08 PM
RE: scroll problems - by patrickdrd - 04-23-2019, 06:00 AM
RE: scroll problems - by patrickdrd - 04-22-2019, 09:32 PM
RE: scroll problems - by patrickdrd - 04-23-2019, 08:44 AM
RE: scroll problems - by Admini - 04-23-2019, 03:37 PM
RE: scroll problems - by patrickdrd - 04-23-2019, 04:28 PM
RE: scroll problems - by Admini - 04-24-2019, 02:11 PM
RE: scroll problems - by patrickdrd - 04-25-2019, 07:06 AM
RE: scroll problems - by Admini - 04-25-2019, 08:26 AM
RE: scroll problems - by patrickdrd - 04-30-2019, 10:32 AM
RE: scroll problems - by Admini - 04-30-2019, 03:59 PM
RE: scroll problems - by patrickdrd - 04-30-2019, 04:36 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)