Prevent your webform from showing the “are you sure you want to leave this page” message

When a webpage in your application detects changes made to input items (if they are valid or not), it will present the user a popup asking if he/she wants to leave the page or stay on the page. Although that is useful in many cases, sometimes you just want to switch it off on  a specific page. The solution is really easy.

Place the following Javascript in the onLoad event of your page:

window.onbeforeunload = null;

In for instance, Application Express, you can put it in the Execute when page loads item in the Javascript section of your page.

If you want to show a different message, just replace the null with the message between double quotes.

Laat een reactie achter

Het e-mailadres wordt niet gepubliceerd.

Deze site gebruikt Akismet om spam te verminderen. Bekijk hoe je reactie-gegevens worden verwerkt.

By using this site you acknowledge the use of cookies (which are mostly harmless, btw) More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below you are agreeing to these settings.

Close