1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
---|
2 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
---|
3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
---|
4 | |
---|
5 | <head> |
---|
6 | <title>Test</title> |
---|
7 | <meta http-equiv="content-type" content="text/html;charset=utf-8" /> |
---|
8 | <meta name="generator" content="Geany 0.18" /> |
---|
9 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> |
---|
10 | <script type="text/javascript"> |
---|
11 | function unloadWarning() { |
---|
12 | return "Leaving?"; |
---|
13 | } |
---|
14 | function cancelUnloadWarning(){ |
---|
15 | $(window).unbind("beforeunload") |
---|
16 | } |
---|
17 | $(function() { |
---|
18 | $(window).bind("beforeunload", unloadWarning); |
---|
19 | $("a").click(cancelUnloadWarning); |
---|
20 | }); |
---|
21 | </script> |
---|
22 | </head> |
---|
23 | |
---|
24 | <body> |
---|
25 | <a href="unload.html">This page</a> |
---|
26 | </body> |
---|
27 | </html> |
---|