停止使用 angular 6 打开其他浏览器或外部源

Stop opening other browser or external source using angular 6

当用户接受采访时,如何检测他是否打开了新的 window 或任何其他外部来源?

例如:如果 2 个人在 watsapp 中进行视频通话,如果任何人打开任何应用程序,屏幕上会显示一条消息“您的视频已暂停"

我们如何使用 recordRTC 或 WebRTC

将其引入 angular6

你不能,而且可能会更好。您只能确定您的选项卡是否未获得焦点 Post。如果 applications/sites 可以通过 javascript

对用户进行 "spy",那将是一场安全噩梦

通过使用 document.focus 得到它可以检测用户打开新标签和外部应用程序

TS

let body = document.querySelector('body');
let log = document.getElementById('log');

if (document.hasFocus()) {
log.textContent = 'This document has the focus.';
body.style.background = '#fff';
}
else {
log.textContent = 'This document does not have the focus.';
body.style.background = '#ccc';
}

HTML

<p id="log">Awaiting focus check.</p>

谢谢大家