diff --git a/files/en-us/web/api/barprop/visible/index.md b/files/en-us/web/api/barprop/visible/index.md index 80d285995d106a7..51bbd241e9ff127 100644 --- a/files/en-us/web/api/barprop/visible/index.md +++ b/files/en-us/web/api/barprop/visible/index.md @@ -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); diff --git a/files/en-us/web/api/window/open/index.md b/files/en-us/web/api/window/open/index.md index 3aac07461b3d17c..9cda5dceb9c74a7 100644 --- a/files/en-us/web/api/window/open/index.md +++ b/files/en-us/web/api/window/open/index.md @@ -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. ### Return value @@ -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); @@ -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" ); } ``` @@ -121,15 +120,43 @@ 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 + +You can specify the _windowFeatures_ parameter to explicitly request that the browser use a popup window +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. + +- `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 present and disabled, it requests that the browser not use a minimal + pop-up window for the secondary window. + +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` all have identical results. + +Otherwise: + +* To not request a popup, omit the _windowFeatures_ parameter. +* Otherwise: + * Specifying any features in the _windowFeatures_ parameter other than `noopener` or `noreferer` has the effect of also requesting a popup. + * Otherwise, no popup is requested. ### Position and size features -`windowFeatures` parameter can specify the position and size of -the new window. +You can use the _windowFeatures_ parameter to control the position and size of the new secondary window, +by specifying feature names using _name=value_ pairs. +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. + +> **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) @@ -178,31 +205,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 -> following features are just a condition for whether to open popup or not. See [popup condition](#popup_condition) section. - -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. +> **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 a popup or not. See the [popup condition](#popup_condition) section. -Example: `status=yes`, `status=1`, and `status` have -identical results. +The following features control the visibility of each UI part. +To enable them, either specify them with no value at all, or else set them to `yes` or `1`. +To disable them, either omit them, or else set them to `no` or `0`. - `menubar` @@ -305,7 +316,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. */ } @@ -357,8 +368,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(); }; @@ -387,10 +397,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. */ @@ -671,7 +681,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 condition is described in detail in the ["To check if a popup window is requested"](https://html.spec.whatwg.org/multipage/window-object.html#popup-window-is-requested) section in the spec. ### Note on scrollbars diff --git a/files/en-us/web/api/window/open/obsolete_features/index.md b/files/en-us/web/api/window/open/obsolete_features/index.md index 989e5b94154ee83..dffdcd51f0416c9 100644 --- a/files/en-us/web/api/window/open/obsolete_features/index.md +++ b/files/en-us/web/api/window/open/obsolete_features/index.md @@ -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 in 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 in Firefox; obsolete from Firefox 80) + - : Specifies the height of the whole browser window, in pixels. This + `outerHeight` value includes any and all present toolbars, the window horizontal + scrollbar (if present), and top and bottom window-resizing borders. The minimal required + value is 100. +