[英]how to stay on window/tab without actually stay on that tab
i watch video on website, when i change to other tab我在网站上观看视频,当我切换到其他标签时
video is stop playing.视频停止播放。 and when i change to old tab, video is playing
当我切换到旧标签时,视频正在播放
i want to know there is a trick to prevent video from stop playing?我想知道有什么技巧可以防止视频停止播放?
already try scrollIntoView, focus but not working at all已经尝试 scrollIntoView,聚焦但根本不工作
this is my code (not working)这是我的代码(不起作用)
var requiredElement = document.querySelector('.watch-area-inner');
requiredElement.focus();
requiredElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
You would need to check for blur
and focus
events on window
.您需要检查
window
上的blur
和focus
事件。 Read the Page Visibility Documentation to understand how it works.阅读页面可见性文档以了解其工作原理。 But, I guess there is no way to fake it.
但是,我想没有办法伪造它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.