简体   繁体   中英

Javascript - Detect when user switches to another application

I am working on a web application that plays videos. I need to detect when the user switches to another application so that I can pause the video.

Eg the browser is still open in the background but the user is now busy in Skype or some other app.

This link could help you : Is there a way to detect if a browser window is not currently active?

You should only detect that your app is losing focus that should be enough for you to pause the player.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM