4 ms·
Okay so before I even got to the actual experiment I was impressed that the music on the page only plays while you are currently viewing the page, so if you are
by drunken_thor 14y ago
Okay so before I even got to the actual experiment I was impressed that the music on the page only plays while you are currently viewing the page, so if you are on another tab the music stops! I want to know how to just do that!
- woogley 14y agoAsk and you shall receive: http://www.html5rocks.com/en/tutorials/pagevisibility/intro/ http://www.html5rocks.com/en/tutorials/pagevisibility/intro/
- elisee 14y agoI haven't looked at the source code but according to https://developer.mozilla.org/en-US/docs/DOM/Using_the_Page_Visibility_API https://developer.mozilla.org/en-US/docs/DOM/Using_the_Page_..., you can simply register a onblur / onfocus event handler on the window object (this doesn't use the recent Page Visibility API, it's been possible for a long time)