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
Related
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.
I work in a situation where the computer I use is inconsistent, and I often have never logged onto the computer I'm working on before. As such, I use chrome and launch most of the things I need using the "on startup" option.
My issue is that I have a page that I would like to open in a separate window. I've done some finagling with a javascript bookmarklet that does something similar to what I want, but it isn't perfect.
javascript:window.open("http://google.com","_blank","foobar"); javascript:window.close();
This will open a new window at google.com as expected, however It has a few flaws:
The window is not fullscreen. It will always open at a smaller window size, and is horribly inconsistent on where it will show up.
It isn't a standard window, I can't type in the address bar, add tabs, see my bookmarks bar, or use javascript.
I honestly don't know what the second and third parameters in window.open do, the window will open in a tab instead of a window if I don't have them, but it doesn't care what is there.
I have attempted passing javascript commands through the window.open command, but the window refuses to do any of them.
I understand that this is the type of thing that shouldn't be decided by a webpage, and should be left to a user. But I am the user...
I believe that most of the parameters you mentioned (fullscreen window, window size, other window features) are specified in the third argument of window.open(). For example:
window.open("http://google.com","_blank","fullscreen=yes;menubar=yes;titlebar=yes")
would open http://google.com in a new window (_blank) in fullscreen view (fullscreen=yes;) and render the menubar and titlebar (menubar=yes;titlebar=yes). A list of standard values is provided at w3schools.com and developer.mozilla.org
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).
I tried the following simple pop-up code obtained from here and slightly modified-
<!-- sample.html -->
<script type="text/javascript">
// Popup window code
function newPopup(url) {
popupWindow = window.open(
url,'popUpWindow','height=400,width=400,left=10,top=10,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=no')
}
</script>
Open a popup window
When I run this, a pop window appears as expected. But the scrollbars and the URL are very much there and I could easily resize the window even though I've resizable=no,scrollbars=no,location=no
Why isn't the change to these attributes reflecting in the resultant pop up window?
Strange this is scrollbar attribute reflects properly on Mozilla 10.0.4 and not on Google Chrome 19.0.1084.56
But the other 2 attributes show the same behavior on either of the browsers.
The important thing here is that these settings are suggestions to the browser. The browser vendor may choose to have the browser ignore them. Some vendors (including Mozilla) let users define whether certain settings are ignored (see various notes on MDN's window.open page).
You can avoid scrollbars by styling the resulting document as described in this other answer here (provided the SOP doesn't come into play), but if the browser is supplying location and resizing when you're telling it not to, there's really nothing else you can do — using a pop-up window.
You might consider instead using an absolutely-positioned element within your current window, which is pretty much the modern way to do popups. Your specific example loading Facebook may require you use an iframe (and may try to escape it), though.
I have an IE7 app that needs to open a popup window onto a second screen. I'm fudging this at the moment by extending the desktop and explicitly opening the window at an offset that makes it appear over on the other one. However this seems like a hack and I'd like to be able to explicitly set the window screen when I call window.open(). Is there any way to do this?
I'm pretty sure this isn't possible. I did some testing and the pop-up windows seemed to be restricted to the monitor "with focus".
Demo: jsfiddle.net/Marcel/25W29