| <html> |
| <head> |
| <title>Preloader</title> |
| <script src="prerender_events_common.js"></script> |
| |
| <script> |
| function BeforeUnloadHandler() { |
| // Notify with XHR the RequestCounter that the handler has been executed. |
| // The request must be async in order to be allowed in a beforeunload |
| // handler. |
| var xhr = new XMLHttpRequest(); |
| xhr.open('GET', 'http://unload-url.test', true); |
| xhr.send(); |
| } |
| |
| addEventListener('beforeunload', BeforeUnloadHandler, false); |
| </script> |
| |
| </head> |
| <body> |
| <script> |
| AddPrerender('REPLACE_WITH_PRERENDER_URL', 0); |
| </script> |
| </body> |
| </html> |