Saturday | 23 NOV 2024
[ previous ]
[ next ]

Chrome and onbeforeunload

Title:
Date: 2022-04-10
Tags:  

It looks like Chrome doesn't let onbeforeunload run due to the ease at which you can abuse it. This means that there is no way to trigger a function call when the browser window is closed which is unfortunate. We use that at work to do some clean up when a user leaves the site.

One solution is to use the visibilitychange event which runs when the user switches tabs but that also doesn't work with the window closing.

This means that we'll likely need to use firefox for some applications that require cleanup. We could do time based but there are some things we want to clean up immediately.

I also wrote a very small single file web server to run universe subroutines at will which was fun. This was a simplification of a project I did already using express and before that python.

I think tailwind is really good for PDFs but I think the greater web is a bit more difficult as you end up with very long classes that you need to read to change things. It's better than inline styles but I'm not sure if I'm as big fan as I was.