-2

When a user is taking his interview, how to detect if he is opening a new window or any other external source?

For Example: If 2 persons are having a video call in watsapp , if any one of the person opens any application , a message is displayed on the screen "Your Video is Paused"

How can we bring this in angular 6 using recordRTC or WebRTC

Sravya
  • 65
  • 13

2 Answers2

0

You can't and it's probably for the better. You can only determine if your tab isn't focused Post. It would be a security nightmare if applications/sites can "spy" on users via javascript

Nikolai Kiefer
  • 568
  • 5
  • 15
0

Got it by using document.focus which can detect the user opening a new tab and a external application

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>

Thanks All

Sravya
  • 65
  • 13