Open HeyVern opened 6 months ago
looks like this is the same or similar problem as presented for the Chrome version here: https://github.com/proginosko/LeechBlockNG-chrome/issues/61
Do you have the option "Immediately block pages..." selected?
I do not know if he does, but I do on the Chrome version.
Yes. Works on every page except those that use onunload or onbeforeunload to present a dialog box. Leechblocker tries to navigate away from the page; however, the dialog box is presented about the page navigation, and the user can click cancel.
This is an interesting problem to solve, at least on Firefox. Every time LB tries to block a page with an onbeforeunload listener, the "Leave page"/"Stay on page" dialog box pops up, but LB keeps trying to block the page, resulting in an ever-growing stack of dialog boxes (one for each attempt to block!). You can keep clicking "Stay on page" but LB will keep trying to block it, until you eventually click "Leave page". I'm not sure it's possible for an extension to bypass or disable the onbeforeunload listener, but I will keep investigating.
In the meantime, one workaround for Firefox is to completely disable the beforeunload event:
@proginosko thanks, but users are using chrome.
This site discusses the topic and suggests injecting $(window).off('beforeunload.windowReload');
into the page. It could disable the popups. Not sure if this is possible via the plugin, but it's said to work with Chrome and Edge.
Thanks for doing some research on this. The downside of this solution is that it requires the jQuery library, and while LB uses that for its GUI, it wouldn't really be good practice to inject that entire library into a web page just to remove one event listener! I will continue to investigate alternative solutions.
Any news on this particular issue? Thanks!
Certain webpages use 'onunload' and 'onbeforeunload' to present such messages as "are you sure you want to leave this page"...etc. The issue is, if this is a page you are trying to block with a timer, the user can simple press 'cancel' and the page navigation to the block page is canceled effectively allowing the user to bypass the block until the page is manually refreshed. Is there any way to bypass such prompts and force the page to refresh anyway, or simply block the script execution by filtering it out?
Example page: taming.io
Thanks!