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
Tester and validators
Analyze your web page speed performance. Retrieve information about speed index, latency, first contentful paint and more.
Social Tracking script
Measure and track user interactions with your contents. Track all the events you want: downloads, clicks, video plays, checkout flow, engagement.
Test your Web Vitals metrics, score and diagnostic. Measures Google Core Web Vitals LCP, FID, CLS, TTFB, FCP, TTI, TBT and more.
Validate your Css file sheet with W3C validation Service. Check if the markup of your Cascading style Sheet document is W3C compliant.
Converters
Convert instantly color codes from RGB (red, green, blue) to HEX triplets color schema and vice versa. Insert color and try it for free.
Server and proxy Tester and validators
Perform your site audit and find out what pages missing https/ssl certificate.
Find out how website are built with. Detect technology, framework and CMS website are using.
Convert text into MD5, SHA-1 and Base64 hash string. Type or paste text and get Messade-Digest Algorithm 5, SHA-1 and Base64 hased string.