Reputation: 11232
when we write
window.open(url,target,..)
a new window is opened.. Can anyone tell me how this is happening internally
Upvotes: 0
Views: 206
Reputation: 1075755
Here's everything I can think of:
open
request depending on its pop-up settings (most browsers will ignore calls to open
that aren't in direct response to a user event, like a click). Assuming it allows it:opener
property of the new window so it points to the window
object of the window that issued the open
call.window.open
call returns a reference to the new window
object.Note that the references that the windows have to each other are to the "external" facet of the relevant window
object, which isn't necessarily the same as the actual window object. (Strange but true; it's for security stuff; more in this other StackOverflow question.) So it may be that although you've opened a window, you don't have access to the contents of that window because it's from a different origin.
As to the internals of how browsers actually do it, that's entirely up to the browser implementation. For open source browsers like Firefox and Chrome, you can find out by looking at the source...
Upvotes: 2
Reputation: 2300
The browser creates a new window, sets the name, dimensions, position, options etc, and then loads the URL into it. Is this what you mean?
Upvotes: 0