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
Check SEO performance and page checkup. Over 250 parameters for the deeper page analysis. Find out more about the performance of your website.
Images
Upload yours images and get the color palette. Get color palette for all dominant colors identified in your uploaded image.
Analytics Google Tracking script
Measure and track user interactions with your contents. Track all the actions you want: downloads, clicks, video plays, social share, engagement.
Converters
Convert Timestamp in date time value and vice versa. Convert epoch/unix timestamp in readable date time value and vice versa.
Builders and generators Google
Choose a map theme or build your custom Google map. Customize maps with your own creativity, settings, styles and colors.
Tester and validators
Validate your AMP pages with this tool. Test your Accelerated Mobile Pages, get detailed report and optimize performance.
Builders and generators
Generate required and most useful meta tags for your pages. Provide metadata about your website and help search engines to provide relevant content.
Generate feature-rich htaccess files: www rewrite, hotlink prevention, custom error pages, cache rules and redirects.