New child window under a different parent in javascript - javascript

I have 2 different application server URLs.
There is a link on a page of first application and on click on this link I have to open a new window using href link( maybe window.open()) under second application(not a new tab or child window on same parent).
The parent window should be second URL while click on the link on a page of first URL.
It should be a popup window.

You can control whether a new window is created or not by changing the strWindowName parameter to window.open()
For an anchor you can use the target attribute and provide a browsing context name

Related

In a Chrome Extension, how can I get the parent (or opener) tab of a new window?

If I right click a link and open it in a new tab, I can get the "openerTabId" as described in How do we get the parent tab URL of the current chrome tab?.
But how can I get the parent tab if I open a link in a new window? I have tried:
chrome.windows.onCreated - the callback's parameter is a Window which has no information about the parent. A Window can have an array of tabs - I expected the newly opened Window to have a one-element tabs array (and that the tab would have an openerTabId), but this is optional and my Window does not have a tabs property (why not?).
chrome.tabs.onCreated - this is also triggered when the new window is created, but there is no openerTabId property on the Tab that is passed to my callback.
chrome.tabs.onActivated - i.e. using the same method that works when the link is opened in a new tab in the same window. Same problem as above: I get the active tab id, and then get that tab, but there is no openerTabId.
Is there another way to get the parent tab of a tab in a newly opened window? Or is this an omission in the Chrome API? If so, is it intentional?
I am using Chrome version 66.0.3359.139 on Windows 8.1.

i am opening new window popup using javascript which will restrict user from using its parent window

I am opening new window pop up using window.open method which will restrict user to use its parent window till the new window is not closed. User will not be able switch back to parent window till child window is open.
How can I do it using JavaScript? please guide me..
To disable the parent window until child window closed you might want to use window.showModalDialog() instead of window.open().
To use showmodalDialog click here
note: However, that you can not use window.opener from a modal dialog box (it will always be null) unless you explicitly pass a reference to the parent window in the second argument to showModalDialog() and get it back using window.dialogArguments.

open new window using javascript which will restrict user from using its parent window

I want to open a new window using window.open method which will restrict user to use its parent window till the new window is not closed. User will not be able switch back to parent window while child window is still open.
How can i do it using javascript? please guide me..
If you want the popup window to be modal (i.e. to disable its parent window until it's closed), you might want to use window.showModalDialog() instead of window.open().
Note, however, that you cannot use window.opener from a modal dialog box (it will always be null) unless you explicitly pass a reference to the parent window in the second argument to showModalDialog() and get it back using window.dialogArguments.

How do I open new links outside of an iframe?

Is there any way to make an iframe act as if it were part of the page. Such as when I click a link, it either will open the links in a new tab/window by default, or have it so that when a link is clicked, it will open in the same window, but not just the iframe?
You can just set the target attribute. To open in the current top window (top frame):
Link Text
Or to open in a new window:
Link Text
There's also _parent for the parent window (not necessarily the top) and _self for the current window (the default).
Do you have control of the content that is in the iframe?
You could use target=_top for the links.

How can I open a new tab or window when a link is clicked?

I have same ancors/hyperlink in my html file. These point to a new website outside my site.
So I want that when the user clicks the link it should open a new tab or window. My website page should not be closed.
How can it be done?
open in tabs: there is nothing programatically that you can do to accomplish that, the only thing I'm thinking of is set the browser to open new links in tabs instead of new window...
to open in a new window all you need is to place a target in your anchors
click here
and, by the way there are more options to the target
target="_blank"
opens in a new Blank window
target="_parent"
opens in a Parent window (used when dealing with iframes and you want to open the link in other frame)
target="_self"
opens in it's own/self window (used when dealing with iframes and you want to open the link in the current frame)
target="_top"
opens in the top of all frames (it will open on top of all frames in the page, like a no-frame page will be display)
Click me to open in a new tab/window
Load the linked document into a new
blank window. This window is not
named.
If there is no existing window or
frame with the same name as specified
in the target, a new window is opened
with a name equal to the value of the
target.
Its the setting in a browser that determines whether to open the page in a new tab or in a new window.
Just add target="_blank" to the <a> tag
Click here
The easiest way is to use the target attribute in your anchors and set it to _blank:
Worse Than Failure
This is a dupe of opening links in the same window or in a new (tab) and https://stackoverflow.com/questions/118567/is-there-ever-a-good-reason-to-force-opening-a-new-browser-window. Basically - no. And there shouldn't be a way - you shouldn't impose your surfing preferences on unsuspecting others.

Categories

Resources