- Can we hide "press 'ESC' to hide full screen" message in Angular 8
- Can we ask user to "Do you want to really exit full screen" in Angular 8
Asked
Active
Viewed 256 times
0

swapnil devan
- 1
- 2
-
2The first one would be a security issue - all a malicious webpage would have to do is to render a fake Windows login screen and get your credentials. Similarly - #2 would have to be displayed by the browser. Can't trust the in-page Javascript with it. – John Dvorak Apr 03 '20 at 10:50
-
1This functionality is usually built into the browser (for security reasons). So I don't think you can use JavaScript (Angular-based or otherwise) to control it. What's the reason you want to do it? Are you maybe trying to operate some kind of "kiosk" mode where the user should not be able to switch to other applications? I think there may be other solutions to that, if you search online. – ADyson Apr 03 '20 at 10:51
-
2P.S. There are a number of previous questions about this on StackOverflow, e.g. [Prevent esc from exiting fullscreeen mode](https://stackoverflow.com/questions/21279174/prevent-esc-from-exiting-fullscreeen-mode) . Did you research it much? – ADyson Apr 03 '20 at 10:52
-
@JohnDvorak Thanks for your inputs – swapnil devan Apr 03 '20 at 13:28
-
@ADyson do you mean , Exit full screen is browser functionality so we can't customize it? – swapnil devan Apr 03 '20 at 13:30
-
Yes that's exactly what I mean. As John Dvorak's comment says, and the suggested other question also mentions, this is done deliberately for security reasons. Otherwise, a malicious website could switch to fullscreen, hide the ways to escape, and use it to create something like a spoof login screen so they could steal people's details, or try to ransom them to unlock etc. Lots of ways to scam inexperienced or unsuspecting users. So for that reason, you cannot change this functionality. Like I said...what is the real end goal here? You can probably find another solution. – ADyson Apr 03 '20 at 14:03
-
@ADyson When user exit from full screen then we directly logout from application. Our goal is to ask confirmation to user when he want exit the full screen. – swapnil devan Apr 03 '20 at 14:28
-
Well, you can handle the event when the user exits from fullscreen. See https://stackoverflow.com/questions/10706070/how-to-detect-when-a-page-exits-fullscreen and https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API You can also enable fullscreen mode using script as well: https://stackoverflow.com/a/39757315/5947043 . So I guess you could wait for the event when the user exits fullscreen, then you pop up a confirmation asking if they really want to exit and logout. If they do, then proceed. If not, open fullscreen for them again. This stuff is quite easy to google, btw! – ADyson Apr 03 '20 at 14:34
-
But what you can't do is prevent them using the Esc (or F11 in some browsers) key to exit fullscreen. Like we said, that's there for security reasons, so the user always has full choice and control. – ADyson Apr 03 '20 at 14:38
-
@ADyson Got it. Thank you very much – swapnil devan Apr 06 '20 at 04:22