Accessibility
You should never treat the unload event as a guaranteed callback, using it as an end-of-session signal to send analytical data and save state.
In fact, in many download situations the unload event will not fire.
Always rely on the visibilitychange event if you want to determine when a session ends, and as the last reliable time to save both app and user data, consider the state hidden.
Browsers can only be prevented from caching pages Back-Forward by the presence of a registered unload event handler (via onunload or addEventListener()).
It is therefore advisable to use the pagehide event on all modern browsers (including IE11) in order to detect page unloads.
const terminationEvent = 'onpagehide' in self ? 'pagehide' : 'unload'; addEventListener(terminationEvent, (event) => { // Note: if the browser is able to cache the page, `event.persisted` // is `true`, and the state is frozen rather than terminated. }, {capture: true});
Learn more about Accessibility
On page SEO performance and page checkup.
Over 300 parameters for the deeper page analysis.
Share this Guide
Did you like it? Share it!
Web tools for modern developers. Try these one!
Over 50 generators, builders and validators to improve your SEO and web performances
Server and proxy
IP Address and Domain Name Geolocation Lookup Tool. IPv4, IPv6 and domain name Geolocation. Accurate IP and Domain name lookup database.
Converters
Convert Timestamp in date time value and vice versa. Convert epoch/unix timestamp in readable date time value and vice versa.
Tester and validators
Test your web pages structured data. Check conformity of your structured data json-ld and improve your SEO.
Builders and generators Social
Transform web pages in rich objects in a social graph. 25 Open Graph type to create a huge impact of social traffic on your website.
Images
Zoom in, scale, flip, rotate, crop and resize your images. Upload and edit yours images file for free with dunplab image editor.
Server and proxy Tester and validators
Find out how website are built with. Detect technology, framework and CMS website are using.
Retrieve your Public IP Address and geolocation. Get your IP address, ISP-Organization information and geolocation data for free.
Test your Progressive Web App. Check the performance of your PWA, try to deliver high quality, engaging, fast and capable apps on every devices.