Force browser on top and work in other windows - javascript

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.

Related

How to know if the browser is pinning by the android screen pin

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.

Key press detection without focus

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.

Launch a Windows File Explorer window from a webpage

I work in phone support for a company that released a new program that stores some data in the users appdata folder.
Our knowledge base has been updated with steps for users to turn on show hidden/system files and then steps users through opening the folders.
As a lot of our software users are not IT 'savvy', it takes a long time walking them through.
With HTML, Javascript or some kind of plug in, is it possible to make a link on a page that will launch a Windows File Explorer window navigated to %localappdata% ?
This way the user will always end up in the right place without all the steps they find difficult.
No, it isn't possible to launch an external program from within a web page.
If you could do it, it would be considered a massive security risk, and would quickly be blocked by the browser makers.
Years ago, there used to be ways to achieve this sort of thing via ActiveX controls, but that is no longer an option, largely due to the security issues it caused.
The only browser that ever supported ActiveX was IE; it doesn't work at all in any of the other browsers, and even IE defaults to block unknown ActiveX controls these days.
In short, you aren't going to be able to do this. Sorry.
I don't believe this is possible with just HTML / javascript because of permission / security
One possibility is to create a ActiveX control to launch Windows Explorer.
Building ActiveX Controls for Internet Explorer
Wikipedia - ActiveX
You could have users download and run a batch file with something like this in it:
%windir%\explorer.exe %LOCALAPPDATA%
You could even configure the batch file to copy files to a more convenient place, like the desktop.

Not allow any other application to open except a browser

I am presently working on website (Java EE). One of the requirements is to not let the client to open anything else other than the browser. After a lot of search I got the following results :
Change the policy of the OS.
Write some batch/c/c++ program which will intercept all the keyboard and mouse events not letting the user open anything else.
PS : It should work on windows and IE 7 or above only. The other OS and browsers need not be considered. This software is made only for intranet, so I already have control on the client machines if I have to run something.
My question is .. is there anything else I can do which will reduce the work needed on the client side or on the program which I have to write??
This is very OS specific I'd say. Windows, I believe, has APIs related to finding open windows. You could find all open windows and close them. In your application's main loop you can detect if any windows are open then close them.
Perhaps mac and ubuntu have something similar.
This might be a good place to start looking: http://msdn.microsoft.com/en-us/library/ms633497%28VS.85%29.aspx
I have no idea how to use it though.
You'll need something more powerful than javascript to communicate with your application that is monitoring the user's desktop. You may want to look at connecting JS to Silverlight then having the client download something upon opening the browser that is also similar to silverlight or .net. Then you can have them all communicate possibly.
You can set IE to be the shell process (a registry key) instead of explorer.exe, and then run IE in kiosk mode, and then disable task manager via policy (to prevent new processes).

Is there a setting in FireFox to allow the parent document access to the DOM of an IFRAME on another domain?

Notice how Firebug can access the DOM of cross domain iframes and even allow you to modify them? I'm wondering if there is an firefox addon extension or a config setting that will allow a page on our intranet to do this.
Longer explanation:
I have a two "kiosks" in our reception area that the public can use. As we're running in kiosk mode (fullscreen, no chrome), I have created a small web application consisting of a menu and an IFRAME. The menu allows users to browse to approved sites and also perform actions like printing. It also gloms onto requests for popup windows and instead overlays them in a modal iframe rather than allowing the browser and OS chrome to be exposed - breaking the "kiosk" experience.
Obviously, this works perfectly on anything internal because it's all on the same domain. It gets trickier when browsing external sites because the XSS protection kicks in and you can't see the DOM inside the IFRAME.
I have also tried using a web-based proxy server on the same domain (PHProxy for example), which works okay, but there are horrible edge cases where it doesn't work - a big one is the CAPTCHA on our website forms. So that's pretty much not an option for me.
Basically I think the only solution that will work for me is to modify the browser in some way using a security setting or an addon. Any ideas?
Thanks guys very much for you time and consideration. It is VERY much appreciated.
--Iain
There is a way for unpriviledged JavaScript code (loaded from a web page) to request more privileges in Firefox. This is an old, non standard API that prompts the user for permission and if accepted allows the JavaScript to do things normal JavaScript cannot. One of these things is to bypass Same Origin Policy.
Sample code:
try {
// ask user for permission
netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
} catch (e) {
// user refused permission
alert('Permission "UniversalBrowserRead" was denied.');
}
//Should now be capable of bypassing same origin policy if user accepted
Since the kiosk browser does not restart (I suppose) very often, the dialog just has to be accepted once. Not sure this is the most elegant solution but might work, at least for now (the API is old and might disappear).
Here is a link for more details: http://www.mozilla.org/projects/security/components/signed-scripts.html#privs-list
While looking for the exact privilege name I found this page about Security Policies in Firefox. This would be a much nicer solution. I have never used it, so I cannot give more info, but here is the link, might be a good place to start looking:
http://www.mozilla.org/projects/security/components/ConfigPolicy.html
Hope this helps!
I found an addon called CrossDomain. The addon hasn't yet been updated for newer versions of Firefox. In the end, I solved this whole problem by writing an HTA and using the internet explorer rendering engine - which made my IT manager happy :). Here is the link to CrossDomain in case this helps someone one day. Thank you everyone for your submissions.
https://addons.mozilla.org/en-US/firefox/addon/13004/
Why not use Greasemonkey, it will allow you to run your script on any page.

Categories

Resources