Hacker News new | past | comments | ask | show | jobs | submit login

Article author here. Most of the comments so far are talking about using lots of tabs, but what I think is actually the most interesting part (or parts) of the article hasn't been mentioned at all.

As I was doing my research for the article, I found a lot of things that really surprised me. And I feel pretty confident in saying that most web developers aren't aware of these things either.

Here are my top four:

- We shouldn't use the unload event. Ever.

- The unload event often doesn't fire when closing tabs/app on mobile

- The pagehide/pageshow events even exist (virtually no one I've talked to knows what they do; most people think they're about page visibility).

- In browsers that implement a page navigation cache, you can click a link to navigate away and then navigate back with the back button, and all your JS code is exactly as it was before you navigated.

To this last point. Try doing this in the console:

1. Write a promise that resolves in a setTimeout after 5 seconds.

2. After 1 second, click a link to navigate to a new page.

3. Stay on that page for an hour.

4. Click that back button.

5. Your promise will resolve in 4 seconds!




You can see the last point in action on a number of places. I can think of two sites in particular that pop up "You will be signed out in XX [decreasing number] seconds unless you click 'Continue'." messages. I can come back to the site's tab three hours later, and the countdown just started!




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: