How to detect if current window is behind another window, using Javascript - javascript

Is it possible to detect whether the web browser window is currently covered by another window?
document.hidden and document.visibilityState only changes state on switching tabs or when the entire window is minimized.
document.hasFocus() returns false if the window is visible but not in focus (e.g. the focus is on the taskbar)

Nope, that's not possible.
There's no way in JavaScript to know how visible the window is.

Browser windows overlapping one another, the position of the browser windows, and which one of them is on top - these functionalities are handled by the operating system.
No matter what code you write for your webpage, you cannot tell if your browser window is overlapped by another.
So yeah, the answer is NO.

Related

detect browser window resize without event

I would like to know if, in Javascript in general (and in Angular in particular), it is possible to check if the browser window has been previously resized by the user, e.g. if the user has landed on my page on an already resized browser.
Thanks in advance,

How to force jqxWindow to be topmost

I use js jqxWindow on my web page. They are frames allowing to be moved, resized, and got focus.
But each time I select a jqxWindow, this becomes the topmost one.
I need to kept some other windows topmost. How to do that ?
I believe that the only solution for this is to apply bringToFront in the opening code of the other windows to the window, which shall always be on top.

JavaScript window options

I'm looking to create a "pop-up" window that simply displays text within the window without the browser's signature. When I create a window simply by using the window.open command, the Chrome symbol and address bar is displayed.
Is there a way to get rid of this?
Or is there a smarter way of doing this?
Also, with that being said, I want this window to stay on top of all other windows being displayed. That is, I want it to essentially be running on top of a window even though I may be clicking on a full screen window behind it.
No, this is intentionally made not possible (at least in Chrome) because it could be used to confuse the user to think that a browser window is a window for another program.
Google Chrome window.open height includes URL bar

Moving XUL window

I'm working on an app, which is based on Firefox and what I need to build is an in-app password manager. I'm planning to populate it once and hide it from view outside of the window frame, bringing it in-frame when it is needed. Now, I have read about the rules applied to moveTo, namely
"You can't move a window or tab that wasn’t created by window.open.
You can't move a window or tab when it’s in a window with more than one tab."
I was wondering if there are any exceptions to that rule? I have full access to chrome, so I was wondering if there's some more low-level way to achieve the moveTo form there?
Thanks a lot!
The restrictions of window.moveTo() don't apply to code running with system privileges. I just tried typing top.moveTo(-1000, 0) into the Error Console - it moved the window off-screen, something that unprivileged code isn't allowed to do. Still, opening the window off-screen is not possible as far as I know (you can however move it in a load event handler, when the window is still invisible). Also, the task manager still shows that window - it is possible to Alt-Tab to it, then press Alt-Space and choose "Move" from that system menu (that's on Windows).

How to check the browser page is always on the top using javascript

I have write a test site, when user begin test, i will open a new window, and i don't want user can change the browser window, how could i check the user is always on my window, i can only thought to check whether the user is pressing the alt+tab or the mouser is leave the window use javascript. So, Are there any other better solution?Thanks!
I don't think there are any other solutions.
The browsers wouldn't let you do this.
But I can't see how it would work with the solutions you have:
- You can't set the position of the cursor, so you can't stop the mouse in leaving the window,
- You can't stop the system in using the Alt+tab, you can only controle the browser window.
But if you're getting it work, please write your solution in this threat, thanks

Categories

Resources