Answer the question
In order to leave comments, you need to log in
How to disable the confirmation window for leaving the site if the fields are filled?
Through tampermonkey, I automatically insert data into the fields on the site. At the same time, in order to close the page of the site, you need to confirm the dialog every time. How to disable it? "onbeforeunload" - did not help.
Answer the question
In order to leave comments, you need to log in
Option 1. If you know which method is subscribed to beforeunload, then you need to take it and unsubscribe it.
Option 2. window.confirm = null (or another method that displays this ugly window).
But there is a subtlety here: content scripts are executed by Chrome in its own, separate, context. To access the main context of a page, you need to inject a script element into it, and inline script cannot be injected. So here, probably, a simple user script is not enough - you need to write a full-fledged browser extension.
The window pops up only on a certain site?
If yes, then block pop-ups on this site.
To manually allow pop-ups on a site, follow these steps:
Open the Chrome menu Chrome menu on the browser toolbar.
Select Settings.
Click Advanced Settings.
In the "Personal Information" section, click the Content Settings button.
In the Pop-ups section, click Manage Exceptions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question