Can current window gets moved or resized? - javascript

I am somehow familiar with javascript and I am trying to learn all the properties and methods of window, document etc objects.My question is related with methods like resizeBy,resizeTo,moveTo,moveBy.I am seeing all the methods in action and all they do is effecting new window opened based on examples online.Is it possible that this methods effect the default window opened in a tab without trying to do in other windows opened?

According to https://developer.mozilla.org/en-US/docs/Web/API/Window:
In a tabbed browser, each tab is represented by its own Window object; the global window seen by JavaScript code running within a given tab always represents the tab in which the code is running.
So, yes.

Related

Close browser tab (window) in angular

I there any trick that I can use to close browser tab (window) in angular. most of methods I tried are not working.
the error I got is "scripts may close only the windows that were opened by them". help to ignore this
The Window interface represents a window containing a DOM document; the document property points to the DOM document loaded in that window.
A global variable, window, representing the window in which the script is running, is exposed to JavaScript code.
Where the window.parent property returns the immediate parent of the current window, window.top returns the topmost window in the hierarchy of window objects.
You can simply use the following code:
window.top.close();
The Window self() property is used for returning the current window. It is generally used for comparison purposes while using other functions such as top().
You can simply use the following code:
window.self.close();
Warning!
Sometimes you can't close the current window in Firefox because you didn't open it.
Most people have their browser set to open new windows in a new tab, and you can't prevent the menu bar etc in a tab window.
If you use close() method, This method can only be called on windows that were opened by a script using the Window.open() method. If the window was not opened by a script, an error similar to this one appears in the console:
Scripts may not close windows that were not opened by script.

Open multiple windows on chrome start

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

TideSDK - Set child window always to topMost of main window

I have a project that consists in creating an app that works on top of other apps. My app stays always on top and allows transparency for interaction with apps bellow. All is going ok, I've applied topMost (true) to the app and its ok.
Because I ways having problems with getting window dialogs (alert but not prompt nor confirm) to stay on top and void interaction with my main window until it gets closed - https://groups.google.com/forum/#!topic/tidesdk/yYkEcC6X5y0 - I had to create my own dialog windows. I managed to get this one going by creating a child window, setting its property topMost to true and always refocusing the dialog whenever there was an atemp to activate/focus main window.
My problem comes when another window needs to be created to act like a Photoshop floating tools window. This window looses its focus and gets beneath main window during itereaction with main app and dialogs. I need this window to always stay on top of main window and under dialog tools so that UX gets correct.
I've managed to get the window to stay on top, but I'm playing arround with focus and unfocus for all windows and it is getting messy.
Does anyone no how can I get to set the order from a main window and all its child windows?
Thanks,
Peter
I've managed to solve this one quickly, so here it is:
When creating all windows (main, tools and dialogs) I only use the topMost param property on method createWindow
( https://github.com/TideSDK/TideSDK-doc/tree/master/source/guides/getting_started#window-elements ).
On main window I only use the tiapp.xml properties
(https://github.com/TideSDK/TideSDK-doc/tree/master/source/guides/getting_started#tiappxml-configuration).
It is only with the tools window that I invoke method setTopMost (true) at window init (one time execution). This way the window will always stay on top of all.
Finally for the dialogs I force focus whenever user tries to interact with tools or main window.
so order goes like this (top to bottom)
dialog ( xml property topMost and always forcing focus )
tools ( xml property topMost and setTopMost method on init )
window ( xml property topMost )
Turns out the previous solution wasn't correctly tested. Main app did not have the tiapp.xml defining top-most to true. So I guess I need to take a deeper look into this issue
:(

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

Window focus for a faster loading pop-up

I am very new to JavaScript. Kindly note that I am trying below issue in a shell which overrides many JavaScript functions.
I have an issue with focusing a window: on a single "click" action, I navigate to a new page which has two JavaScript methods which launch two external URLs which I don't own. For example I launch Yahoo.com and Google.com. My JS launches Yahoo.com in current window (as a page navigate) and Google.com as a pop-up. I WANT Google.com WINDOW TO BE FOCUSED irrespective of loading time of either URLs. The major issue is I cannot use the setTimeout JS function as this function's behavior is altered within the shell and is not usable.
Note: I am using a custom reusable JS function to launch external URLs and I just pass values to that method. So I don't even have access to window object. If I can somehow achieve a time delay without using setTimeout, it will be ideal case. If not, I will have to override that custom JS function, get access to the window object. Even if I have control over those window objects for external URLs, since loading times are different, setting focus to the Google window object is not always giving me the focus on Google window.
(IE6 & 7)
You cannot guarantee the behavior you want, in general; browsers will not let you.
Safari generally ignores requests to focus windows. Firefox and I think Chrome can be configured by their users (not by your code) to allow focus requests, but by default they won't.

Categories

Resources