Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document conditions for popup-opening by window.open, and BarProp values #10339

Merged
merged 23 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a2ccacb
Standardize the condition for opening a popup by window.open, and Bar…
arai-a Nov 7, 2021
c4355a3
Update files/en-us/web/api/window/open/index.md
sideshowbarker Nov 7, 2021
4f4b261
Update index.md
arai-a Nov 7, 2021
05dad17
Update files/en-us/web/api/window/open/index.md
sideshowbarker Nov 7, 2021
494f375
Update files/en-us/web/api/window/open/index.md
sideshowbarker Nov 7, 2021
173a317
Update files/en-us/web/api/barprop/visible/index.md
sideshowbarker Nov 7, 2021
b489ed1
Update files/en-us/web/api/window/open/index.md
sideshowbarker Nov 7, 2021
0553c8f
Update files/en-us/web/api/window/open/index.md
sideshowbarker Nov 7, 2021
184dece
Update files/en-us/web/api/window/open/index.md
sideshowbarker Nov 7, 2021
129e4fb
Update files/en-us/web/api/window/open/index.md
sideshowbarker Nov 7, 2021
83349d7
Update files/en-us/web/api/window/open/index.md
sideshowbarker Nov 7, 2021
368aeb9
Update files/en-us/web/api/window/open/index.md
sideshowbarker Nov 7, 2021
4f2ea9a
Apply suggestions from code review
sideshowbarker Nov 7, 2021
dbd3667
Update index.md
arai-a Nov 7, 2021
9fd03d6
Update files/en-us/web/api/window/open/index.md
sideshowbarker Nov 7, 2021
edd5a82
Update files/en-us/web/api/window/open/index.md
sideshowbarker Nov 7, 2021
4016a3d
Update files/en-us/web/api/window/open/index.md
sideshowbarker Nov 7, 2021
07a5d90
Update files/en-us/web/api/window/open/index.md
sideshowbarker Nov 7, 2021
f2774eb
Update files/en-us/web/api/window/open/index.md
sideshowbarker Nov 7, 2021
52b0249
Update files/en-us/web/api/window/open/obsolete_features/index.md
sideshowbarker Nov 7, 2021
961c7a9
Update files/en-us/web/api/window/open/index.md
sideshowbarker Nov 7, 2021
3bab221
Update files/en-us/web/api/window/open/index.md
sideshowbarker Nov 7, 2021
82c1988
Remove boolean feature description from position and size
arai-a Nov 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions files/en-us/web/api/barprop/visible/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ let visible = BarProp.visible;

### Value

A {{jsxref("Boolean")}}, which is true if the bar represented by the used interface element is visible.
A {{jsxref("Boolean")}}, which is true if the top-level window is opened by
{{domxref("window.open")}} with the {{domxref("window.open", "requesting a popup window", "popup_feature", 1)}}.

> **Note:** Historically this represented whether the interface element used is visible
> or not. But for privacy reasons, this no longer represents the actual visibility of each
> interface element.

## Examples

The following example prints `true` to the console if the location bar is visible, `false` if it is not.
The following example prints `true` to the console if the window is not a popup.

```js
console.log(window.locationbar.visible);
Expand Down
85 changes: 45 additions & 40 deletions files/en-us/web/api/window/open/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ var window = window.open(url, windowName, [windowFeatures]);

- `windowFeatures` {{optional_inline}}
- : A {{domxref("DOMString")}} containing a comma-separated list of window features
given with their corresponding values in the form "name=value". These features include
options such as the window's default size and position, whether or not to include
toolbar, and so forth. There must be no whitespace in the string. See
{{anch("Window features")}} below for documentation of each of the features that can
be specified.
given with their corresponding values in the form _name=value_ — or for boolean features, just _name_. These
features include options such as the window's default size and position, whether or
not to open a minimal-popup window, and so forth. See {{anch("Window features")}}
below for documentation of each of the features that can be specified.
sideshowbarker marked this conversation as resolved.
Show resolved Hide resolved

### Return value

Expand Down Expand Up @@ -82,7 +81,7 @@ creation and the loading of the referenced resource are done asynchronously.

```js
var windowObjectReference;
var windowFeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes";
var windowFeatures = "popup";

function openRequestedPopup() {
windowObjectReference = window.open("http://www.cnn.com/", "CNN_WindowName", windowFeatures);
Expand All @@ -96,7 +95,7 @@ function openRequestedPopup() {
windowObjectReference = window.open(
"http://www.domainname.ext/path/ImageFile.png",
"DescriptiveWindowName",
"resizable,scrollbars,status"
"left=100,top=100,width=320,heigth=320"
);
}
```
Expand All @@ -121,15 +120,38 @@ parameter is not provided (or if the `windowFeatures` parameter is
an empty string), then the new secondary window will render the default toolbars of the
main window.

> **Note:** In some browsers, users can override the
> `windowFeatures` settings and enable (or prevent the disabling
> of) features. Further, control of some window features is available only on some browsers
> and platforms (See [popup condition](#popup_condition) section)
### Popup feature

The _windowFeatures_ features parameter can be used to explicitly request that the browser use a popup window
sideshowbarker marked this conversation as resolved.
Show resolved Hide resolved
with minimal UI parts for the new secondary window.

Whether or not to use a popup window affects the {{domxref("BarProp.visible")}} value.

> **Note:** In some browsers, users can configure the browser to not to use a popup window. Also, some
> browsers, such as mobile browsers, don't have the concept of windows.

To enable the feature, specify `popup` either with no value at all, or else set it to `yes` or `1`.

Example: `popup=yes`, `popup=1`, and `popup` have identical results.

To disable the feature, ether don’t specify it all all (omit it), or else set it to `no` or `0`.
sideshowbarker marked this conversation as resolved.
Show resolved Hide resolved

- `popup`

- : If this feature is present and enabled, it requests that the browser use a minimal pop-up
window for the new secondary window.
If this feature is not present, or is present and disabled, it requests that the browser not use a minimal
pop-up window for the secondary window.

sideshowbarker marked this conversation as resolved.
Show resolved Hide resolved
### Position and size features

`windowFeatures` parameter can specify the position and size of
the new window.
The _windowFeatures_ parameter can specify the position and size of the new secondary window,
by specifying feature names either using _name=value_ pairs, or for boolean features, using just a _name_.
If any feature names are given, and the `popup` feature name is not given, it requests that the browser
use a minimal pop-up window for the secondary window.
sideshowbarker marked this conversation as resolved.
Show resolved Hide resolved

> **Note:** In some browsers, users can override this behavior. Also, it has no effect in
> mobile browsers, which lack the concept of windows.

[Note on position and
dimension error correction](#note_on_position_and_dimension_error_correction)
Expand Down Expand Up @@ -178,31 +200,15 @@ If the `windowFeatures` parameter is non-empty and no size
features are defined, then the new window dimensions will be the same as the dimensions
of the most recently rendered window.

### Browser-dependent size features

> **Warning:** Do not use them.

- `outerWidth` {{deprecated_inline}} (only on Firefox, obsolete from Firefox 80)
- : Specifies the width of the whole browser window in pixels. This
`outerWidth` value includes the window vertical scrollbar (if present) and
left and right window resizing borders.
- `outerHeight` {{deprecated_inline}} (only on Firefox, obsolete from Firefox 80)
- : Specifies the height of the whole browser window in pixels. This
`outerHeight` value includes any/all present toolbar, window horizontal
scrollbar (if present) and top and bottom window resizing borders. Minimal required
value is 100.

### Toolbar and UI parts features

> **Warning:** In modern browsers (Firefox 76 or newer, Google Chrome, Safari, Chromium Edge), the
> **Warning:** These features are kept only for backward compatibility.
> In modern browsers (Firefox 76 or newer, Google Chrome, Safari, Chromium Edge), the
> following features are just a condition for whether to open popup or not. See [popup condition](#popup_condition) section.
sideshowbarker marked this conversation as resolved.
Show resolved Hide resolved

The following features control the visibility of each UI parts, All features can be set
to `yes` or `1`, or just be present to be on. Set them to
`no` or `0`, or in most cases just omit them, to be off.

Example: `status=yes`, `status=1`, and `status` have
identical results.
The following features control the visibility of each UI parts, these features can also
be set to `yes` or `1`, or just be present to be on. Set them to `no` or `0`, or in most
cases just omit them, to be off.
sideshowbarker marked this conversation as resolved.
Show resolved Hide resolved

- `menubar`

Expand Down Expand Up @@ -305,7 +311,7 @@ function openFFPromotionPopup() {

{
windowObjectReference = window.open("http://www.spreadfirefox.com/",
"PromoteFirefoxWindowName", "resizable,scrollbars,status");
"PromoteFirefoxWindowName", "popup");
/* then create it. The new window will be created and
will be brought on top of any other window. */
}
Expand Down Expand Up @@ -357,8 +363,7 @@ var windowObjectReference = null; // global variable

function openRequestedPopup(url, windowName) {
if(windowObjectReference == null || windowObjectReference.closed) {
windowObjectReference = window.open(url, windowName,
"resizable,scrollbars,status");
windowObjectReference = window.open(url, windowName, "popup");
} else {
windowObjectReference.focus();
};
Expand Down Expand Up @@ -387,10 +392,10 @@ var PreviousUrl; /* global variable that will store the
function openRequestedSinglePopup(url) {
if(windowObjectReference == null || windowObjectReference.closed) {
windowObjectReference = window.open(url, "SingleSecondaryWindowName",
"resizable,scrollbars,status");
"popup");
} else if(PreviousUrl != url) {
windowObjectReference = window.open(url, "SingleSecondaryWindowName",
"resizable=yes,scrollbars=yes,status=yes");
"popup");
/* if the resource to load is different,
then we load it in the already opened secondary window and then
we bring such window back on top/in front of its parent window. */
Expand Down Expand Up @@ -671,7 +676,7 @@ UI-related items of `windowFeatures` are used as a condition to
whether opening a popup or a new tab, or a new window, and UI parts visibility of each
of them is fixed.

The condition is implementation-dependent and not guaranteed to be stable.
The detailed condition is described in ["To check if a popup window is requested"](https://html.spec.whatwg.org/#popup-window-is-requested) section in the spec.
sideshowbarker marked this conversation as resolved.
Show resolved Hide resolved

### Note on scrollbars

Expand Down
10 changes: 10 additions & 0 deletions files/en-us/web/api/window/open/obsolete_features/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@ This page lists the obsolete `windowFeatures` parameter of [window.open](/en-US/
- `personalbar` {{deprecated_inline}}
- : If this feature is on, then the new secondary window renders the Personal Toolbar in Netscape 6.x, Netscape 7.x and Mozilla browser. It renders the Bookmarks Toolbar in Firefox. In addition to the Personal Toolbar, Mozilla browser will render the Site Navigation Bar if such toolbar is visible, present in the parent window.
Mozilla and Firefox users can force new windows to always render the Personal Toolbar/Bookmarks toolbar by setting `dom.disable_window_open_feature.personalbar` to _true_ in [about:config](http://support.mozilla.com/en-US/kb/Editing+configuration+files#about_config) or in their [user.js file](http://support.mozilla.com/en-US/kb/Editing+configuration+files#user_js).
- `outerWidth` {{deprecated_inline}} (only on Firefox, obsolete from Firefox 80)
- : Specifies the width of the whole browser window in pixels. This
`outerWidth` value includes the window vertical scrollbar (if present) and
left and right window resizing borders.
- `outerHeight` {{deprecated_inline}} (only on Firefox, obsolete from Firefox 80)
- : Specifies the height of the whole browser window in pixels. This
`outerHeight` value includes any/all present toolbar, window horizontal
scrollbar (if present) and top and bottom window resizing borders. Minimal required
value is 100.
sideshowbarker marked this conversation as resolved.
Show resolved Hide resolved