Namespace: Navigation:openWindow

Navigation:openWindow

Methods

openWindow(urlopt, optionsopt, nullable, parentWindowopt, nullable, tryAsPopupopt, nullable) → {Window}

Opens a sub-window for the current window or another defined parent window. Be aware that most browsers open new windows as a tab by default, have a look at the "tryAsPopup"-parameter if you need to open a new standalone window and your configuration results in new tabs instead.

For window options (in this implementation, we consider "name" to be an option as well), see: https://developer.mozilla.org/en-US/docs/Web/API/Window/open#window_features

Keep in mind to set "noopener" and/or "noreferrer" for external URLs in options, to improve security and privacy. Hint for older MS browsers: if you set these security options, these will most likely open the URL in a popup window. If you want to circumvent this, you'll have to drop the "noreferrer" and settle for "noopener", by setting opener to null on the returned window like this: openWindow('url').opener = null;

Parameters:
Name Type Attributes Default Description
url String | URL <optional>
null

the URL to load in the new window, if nullish, the current URL is used

options Object <optional>
<nullable>
null

parameters for the new window according to the definitions of window.open & "name" for the window name

parentWindow Window <optional>
<nullable>
null

parent window for the new window, current if not defined

tryAsPopup Boolean <optional>
<nullable>
false

defines if it should be tried to force a real new window instead of a tab

Source:
See:
  • Urls.urlHref
Throws:

error if url is not usable

Returns:
the newly opened window/tab
Type
Window
Example
openWindow('/img/gallery.html');
openWindow('http://www.kittens.com', {name : 'kitten_popup'}, parent);