Hacker News new | ask | show | jobs
by JD557 3039 days ago
Most browsers already send you a warning if the main thread appears to be blocked. Maybe they could also add a warning like:

> This page is consuming a lot of resources, do you want to keep executing JavaScript on this page?

> Stop / Allow only this time / Allow always

3 comments

Possible but if you set the limit too low you're going to have it pop it all the time on heavier websites (especially on less powerful hardware/smartphones). Then you condition the user to dismiss these warnings without thinking about it because of the high rate of false positives.

On the other hand if you set it too high then those websites will aim for that limit to maximize profit without triggering the warning. You'll still waste a ton of resources and you've only mitigated the issue somewhat.

I'm not saying it's impossible, just that "just add a dialog when CPU usage is high" might be a bit naive. There's a subtle balance to these things.

Safari already does this kind of. "This webpage was reloaded because it was using significant energy"
site publishers would resort to social engineering ("click yes on the popup to continue reading)