E
E
Evgeny Fedorov2014-11-03 14:52:51
JavaScript
Evgeny Fedorov, 2014-11-03 14:52:51

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.e86e7a2842c34bb080598d26012410e3.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mayorovp, 2014-11-07
@JekFdrv

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.

D
Dmitry Cherednichenko, 2014-11-03
@likeapimp

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 question

Ask a Question

731 491 924 answers to any question