Fast question:
On a website, there is any way to detect when a keyboard key is pressed while the browser is minimized? or when you have the focus on another window?
For example, you open my website on Chrome, and you switch to Spotify for example, I need to detect if the user press a particular key that he previously binded.
I can imagine that's impossible with javascript because you have no focus on the browser, but, there is any way for it? Making a chrome extension maybe? with Java? Silverlight?
I just need to detect the user pressed the key, nothing else.
Thanks!
EDIT:
My users have already installed a C# app on their computers, can I (maybe) detect the key press in the App and call the browser (which is already opened) in any way?
This is not possible, although it should be.
The motivation for why it is not possible is perfectly reasonable. There is no doubt that untrusted webpages should not be able to monitor keyboard activity, as this would allow malicious webpages to monitor confidential activity.
However, there are also perfectly legitimate use cases for being able to do this. A good example is a voice communication Web app. It would be useful for such an app to detect when a particular key is pressed, to provide push-to-talk and other keybindings. But this is not currently possible. Indeed, the Discord Web app has to request that users download the desktop version of the app to use push-to-talk effectively.
The reasonable solution would be to allow Web apps to request permission from the user to monitor all or some keyboard activity when out of focus. This is how location, camera, and other sensitive permissions already work. By default, webpages would not have the permission, and so security would be assured for untrusted webpages. This would be an important improvement for the Web as it seeks to expand its relevance to desktop and mobile environments.
Basically you want a keylogger... and no, it's not possible, luckily.
Related
I am creating a chat application, where I need to send notifications when the user is not watching my website or working in another application.
Now, most of the use cases can be handled using the page visibility API. But there is a particular use case when the user is switching the application from browser to any other application(ex: Outlook), I want to send a notification at that time.
But the issue here is page visibility API does not provide anything on switching applications. That is if the browser active tab has my website and the user switches the application from browser to any other application, it still thinks the user is looking at my website which is wrong because the user is in anther application right now.
I have done R&D on this and I see it is impossible because browsers can't detect these kinds of changes due to security reasons.
But when I checked with Whatsapp web there, javascript is able to find weather user opened the current application or not and based on that they are sending notifications.
So, How can I implement same feature that Whatsapp guys implemented? Is there any web API I am missing here. Are any hacks available to implement this kind feature?
Thanks in advance.
I'm working on a web application that should always be visible on the tablet that opens.
To achieve this, what I have done is to use the 'Pin Screen' function of Android so that users who use the tablet do not leave the web application.
The problem that sometimes users leave in this way pressing the security keys.
For this reason I would like to know if there is any way from Javascript to know if the browser is pinning or not and thus be able to notify it on the server.
Is it possible to force a browser window on top of all other windows and work in other windows at the same time?
I'm trying to make a webpage that gives the user extra information. This window needs to stay in front of Avaya interaction center. But ofcourse the user needs to be able to continue working in other browser windows/ apps.
I tried:
`<body onBlur="window.focus()">`
But that prevents users from working in anything else.
Not as a webpage, no. You cannot interact with OS in that manner. If you have an option to deploy your webpage as an Electron app, then you could leverage something like win.setAlwaysOnTop.
You can't interact with the browser for security reasons. Manipulate browser is impossible .
If in your case it's for noble reasons it can be use for bad reason and block users, imagine you put a website in fullscreen and force it in top you can block the computer for basic user. More dangerous actions are also possible if you allow this kind of action.
I know this is not a specific question, but I just want to get design ideas about a screen sharing web site with SignalR.
We want to add a link on our website which is called "Share My Screen" and then our support team be able to see the content of the browser (not whole desktop) and even they be able to click or type on customer browser.
I was thinking to do it as
Taking screen shot from browser by js (by http://html2canvas.hertzen.com for example)
send taken screen shot to server constantly (I don't know how yet)
Server sends the received screen shot to our support team browser
Capturing mouse move and key press on support team browser
Sending this captured data to customer browser
Since each part of this needs a lot of work I just want to gather all possible ideas to find a tested solution
First of all, I do not think your idea of capturing screen is really doable with javascript technology. Security would be a huge issue, you would need to process a high amount of data, and syncing events would be a nightmare no matter how you approach it. Capturing and sharing tab content and events is a much more manageable goal.
If you are aiming to use this for people who can not manage to install a remote control app, then we can count newer technologies such as WebRTC out due to browser compatibility issues.
There is a good blog post discussing this issue here - (Screensharing a browser tab in HTML5?).
I especially like the first method, using Mutation Observer (browser support) and Web Sockets (browser support). It basically syncs two html documents through the use of mutation observer and uses web sockets for communication. You could use SignalR instead of standard web socket API for communication if you prefer.
Please i need a javascript code button, to check how many devices are connected to the Laptop, and if a particular or certain device is connected Let it open any application.
There's no way you can do this with JavaScript due to security restrictions and API limitations. I guess that you're looking for some Java solution.