CSS - Send HTTP request on Page Exit / Device Fingerprinting

Saw this blog post Reliably Send an HTTP Request as a User Leaves a Page | CSS-Tricks - CSS-Tricks

TL;DR
Fetch() + Keepalive
or
sendBeacon()
or
ping

With more stuff shifting online to web browsers, knowing when a user just closes the webpage instead of logging out “properly” can be useful, this can help you know if they have done that.
Caveats. Whilst MS Edge will also shut down connections to server’s in a timely manner, they can be terminated immediately which can be controlled using the registry and seen using sysinternals Portmon.

Lower these value’s to kill off connections more quickly. Increase on slow flaky network connections.
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSetting
KeepAliveTimeout DWORD value 180000 (in milliseconds)
ServerInfoTimeout DWORD value 180000 (in milliseconds)

Besides using cookies, identifying the user using fingerprinting methods can also be useful.
CSS-Based Fingerprinting | CSS-Tricks - CSS-Tricks
CSS Fingerprint (csstracking.dev)
BrowserLeaks - Web Browser Fingerprinting - Browsing Privacy

Bit of offtopic but might be useful when investigating problems when hosting on the cloud.
Those in the UK who might have seen this news last week
Eon blames Martin Lewis as customers ‘hammer’ websites trying to submit meter readings - Chronicle Live and tried to submit their meter reading to E.ON Energy UK (eonenergy.com), let me pass on a little trick in case this is tried else where in the world.

Drop to the command line (Dos) and tracert their server!
So E.on is hosted on Cloudfront.net (isnt that part of Amazon?) and as soon as you start tracerouting you trigger something (dont know if its GCHQ or the cloud provider who obviously should be able to scale up) but all of a sudden you have no problems logging in and entering your meter reading. In the time it took me to tracert to cloudfront.net I could log on and submit a meter reading, no problem at all! The missus had spent all evening infront of the laptop trying to submit the meter reading! LOL

I only did the tracert to find out where in the world the server was in order to then vpn closer to their server, creating a different route.

But this might be useful when troubleshooting other server connection problems.

Some useful MS Edge settings, might exist in Chrome as well. Dont know how up to date either, havent used all of them