The goog.window
Namespace
Default height for popup windows
Default target for popup windows
Default width for popup windows
.open(linkRef, opt_options, opt_parentWin)
Opens a new window.
linkRef
{string
|Object
}
- A string or an object that supports toString,
for example goog.Uri. If this is an object with a 'href' attribute, such
as HTMLAnchorElement, it will be used instead.
opt_options
{Object
=}
- supports the following options:
'target': (string) target (window name). If null, linkRef.target will
be used.
'width': (number) window width.
'height': (number) window height.
'top': (number) distance from top of screen
'left': (number) distance from left of screen
'toolbar': (boolean) show toolbar
'scrollbars': (boolean) show scrollbars
'location': (boolean) show location
'statusbar': (boolean) show statusbar
'menubar': (boolean) show menubar
'resizable': (boolean) resizable
'noreferrer': (boolean) whether to attempt to remove the referrer header
from the request headers. Does this by opening a blank window that
then redirects to the target url, so users may see some flickering.
opt_parentWin
{Window
=}
- Parent window that should be used to open the
new window.
- returns {
Window
}
- Returns the window object that was opened. This returns
null if a popup blocker prevented the window from being
opened.
.openBlank(opt_message, opt_options, opt_parentWin)
Opens a new window without any real content in it.
This can be used to get around popup blockers if you need to open a window
in response to a user event, but need to do asynchronous work to determine
the URL to open, and then set the URL later.
Example usage:
var newWin = goog.window.openBlank('Loading...');
setTimeout(
function() {
newWin.location.href = 'http://www.google.com';
}, 100);
opt_message
{string
=}
- String to show in the new window. This string
will be HTML-escaped to avoid XSS issues.
opt_options
{Object
=}
- Options to open window with.
{@see goog.window.open for exact option semantics}.
opt_parentWin
{Window
=}
- Parent window that should be used to open the
new window.
- returns {
Window
}
- Returns the window object that was opened. This returns
null if a popup blocker prevented the window from being
opened.
Raise a help popup window, defaulting to "Google standard" size and name.
(If your project is using GXPs, consider using {@link PopUpLink.gxp}.)
linkRef
{string
|Object
}
- if this is a string, it will be used as the
URL of the popped window; otherwise it's assumed to be an HTMLAnchorElement
(or some other object with "target" and "href" properties).
opt_options
{Object
=}
- Options to open window with.
{@see goog.window.open for exact option semantics}
Additional wrinkles to the options:
- if 'target' field is null, linkRef.target will be used. If *that's*
null, the default is "google_popup".
- if 'width' field is not specified, the default is 690.
- if 'height' field is not specified, the default is 500.
- returns {
boolean
}
- true if the window was not popped up, false if it was.