2015-09-23

Notifications on the Web

Hey, web developers!

Have you ever clicked that GMail, Google+, Github, Facebook, or other web site icon or browser tab title that says you have some unread notification waiting for you, only to find that nope, you don't? Because you already saw it, in another open browser tab?

Yes, you have. You, and millions of other people that suffer this every day. In 2015. There is a very simple cure, shipping since 2009. Yes, even IE8 has it. Try opening this example page demonstrating it in two or more browser tabs or windows, and click the buttons in it, and observe how they all update together, instantly. For convenience, the example describes how to do it, too.

It's easy, and supported everywhere. A localStorage event listener is all you need.

Now please sneak this into your next site update, if you love your users. Notifications that lie to us make us all sad.

blog comments powered by Disqus