form-before-unload-confirm Demo

example.com

Procedure

  1. Enter something in the input field.
  2. Select the appropriate anchor link without pressing the submit button, or press F5.
  3. The browser should bring up a confirmation dialog.