1

I have a Google Chrome extension which needs to reload a page in a specific situation. The most common solutions, such as location.reload() did not work as the page shows the prompt "Changes you made may not be saved.".

Please note the page in question is not mine, so I do not have full access to modify it at my will. I am using a Google Chrome extension.

I tried the following approaches:

  • Simulate an "Enter" press when the prompt is shown. The prompt does not identify the event.
  • Modify the function beforeunload. It seems this function is no longer exposed in recent browser versions..

Is there any way to reload the page and ignore the prompt message, either from an injected JavaScript or Google Chrome Extension function?

  • Remove all listeners from unload. Also you could check unload callback function which also may be set – Sergey Aug 01 '19 at 20:00
  • Depends on how that page is defining its beforeunload. If it assigns `window.onbeforeunload` you'll need to set it to null [**in page context**](https://stackoverflow.com/a/9517879). – wOxxOm Aug 02 '19 at 04:46
  • This thread may help you - https://stackoverflow.com/questions/40425682/disable-changes-you-made-may-not-be-saved-pop-up-window – M M Aug 02 '19 at 06:32

0 Answers0