-
Notifications
You must be signed in to change notification settings - Fork 23.1k
Window.open() rework #18118
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
Window.open() rework #18118
Conversation
Preview URLsFlawsNone! 🎉 External URLsURL:
(this comment was updated 2022-07-19 08:09:49.815247) |
| "PromoteFirefoxWindowName". | ||
|
|
||
| More reading on the use of the target attribute: | ||
| The above code solves a few usability problems related to links opening secondary window. The purpose of the `return false` in the code is to cancel default action of the link: if the `onclick` event handler is executed, then there is no need to execute the default action of the link. But if JavaScript support is disabled or non-existent on the user's browser, then the `onclick` event handler is ignored and the browser loads the referenced resource in the target frame or window that has the name `"WikipediaWindowName"`. If no frame nor window has the name `"WikipediaWindowName"`, then the browser will create a new window and will name it `"WikipediaWindowName"`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The above code solves a few usability problems related to links opening secondary window. The purpose of the `return false` in the code is to cancel default action of the link: if the `onclick` event handler is executed, then there is no need to execute the default action of the link. But if JavaScript support is disabled or non-existent on the user's browser, then the `onclick` event handler is ignored and the browser loads the referenced resource in the target frame or window that has the name `"WikipediaWindowName"`. If no frame nor window has the name `"WikipediaWindowName"`, then the browser will create a new window and will name it `"WikipediaWindowName"`. | |
| The above code solves a few usability problems related to links opening secondary windows. The purpose of the `return false` in the code is to cancel default action of the link: if the `onclick` event handler is executed, then there is no need to execute the default action of the link. But if JavaScript support is disabled or non-existent on the user's browser, then the `onclick` event handler is ignored and the browser loads the referenced resource in the target frame or window that has the name `"WikipediaWindowName"`. If no frame nor window has the name `"WikipediaWindowName"`, then the browser will create a new window and name it `"WikipediaWindowName"`. |
|
Among other things:
|
teoli2003
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an amazing rework and a great improvement.
A few comments/errors/typos here or there and we will be able to merge this very soon.
| Alternatively, the following example demonstrates how to open a popup, using the `popup` feature. | ||
|
|
||
| Alternatively, we can open a new _tab_ by omitting window features. | ||
| > **Warning:** Modern browsers have built-in popup blockers, preventing the opening of such popups without explicit action from the user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be interesting to have a working example. For example, can we open a window in a new tab using it if the call happens in a click event handler?
That is what is done in Web Audio API. You can't create an AudioContext, unless in a handler that is triggered by user interaction. I don't know if it works the same way for opening a window in a new tab.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by "explicit action" I meant that they need to change their setting or to open the UI menu to allow popup when some are popping (not really comparable to the way autoplay works :s)
I should reword this to avoid the confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reworded, please let me know if it's clearer/less ambiguous
Co-authored-by: Jean-Yves Perrier <[email protected]>
teoli2003
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
Let's merge this! |
* Move new contrib docs * underscores * renaming * removing redirect about * creating moving * experimental * does belong * editorial * code style guide * writing style guide * howto and seo * related_criteria for inclusion * file rename, link update * Updated Syntax for fetch-related pages (#17914) * Updated Syntax * port changes Co-authored-by: Joshua Chen <[email protected]> * Fix wrong example quote (#18458) * Unshorten code in method definition (#18457) * fixes #18444 * Update index.md Co-authored-by: Joshua Chen <[email protected]> * fix: correct the language of code examples (#18455) * Add `const` var declaration to FileSystemFileHandle sample code (#17930) * Add `const` var declaration * Update index.md * Update index.md Co-authored-by: Joshua Chen <[email protected]> * Update dom-examples links (#18462) * MediaRecorder: Update dom-examples links (#18464) * Update dom-example link (#18465) * update a broken link (#18466) * remove a broken link (#18467) * Update a broken link (#18468) * Fixes broken live sample (#18456) * Intl.NumberFormat - flyby fixes (#18258) * Fix `channelCount` semantics in `MediaStreamAudioSourceNode`. (#18472) * Fix `channelCount` semantics. This sparked confusion, e.g. in WebAudio/web-audio-api#2496. Source: I am this specification's editor. * Fix markup. * Fix parenthesis * Fix `channelCount` semantics. (#18473) * Fix `channelCount` semantics. This sparked confusion, e.g. in WebAudio/web-audio-api#2496. Source: I am this specification's editor. * Fix markup. * Fix parenthesis * Remove a few pointless references to internal slots (#18461) * Remove a few pointless references to internal slots * Update index.md * Apply suggestions from code review Co-authored-by: Jean-Yves Perrier <[email protected]> * simplify description Co-authored-by: Jean-Yves Perrier <[email protected]> * Fix syntax errors (#18475) * Fix syntax error Reported in https://github.com/orgs/mdn/discussions/158 (PR11) The macro just prints `Deprected` on the next line. * Fix in blobbuilder * Remove js annotation for webidl blocks Co-authored-by: Jean-Yves Perrier <[email protected]> * fix: syntax errors in JS example sections (v5) (#18442) * syntax fixes * fix remaining syntax errors * Adapt syntax box Co-authored-by: Jean-Yves Perrier <[email protected]> * Use diff instead of js to mark a diff block (#18477) * Update good vs bad example * fix a typo * marking it as diff * Bump @mdn/yari from 1.10.0 to 1.10.2 (#18479) * Correct a few usage of internal methods (#18476) * Change 'nodes' link to link directly to DOM nodes (#18480) The link to DOM 'nodes' currently links to the 'nodes' glossary page. I changed the link to DOM 'nodes' to directly link to the DOM nodes page. * Shorten Global object glossary entry (#18474) * FF103 Native Error types are serializable (#18384) * FF104 Native Error types are serializable * Fix error - this is in FF103, not 104 * Update files/en-us/web/api/web_workers_api/structured_clone_algorithm/index.md Co-authored-by: Joshua Chen <[email protected]> * Remove stack info from release note * Update files/en-us/mozilla/firefox/releases/103/index.md Co-authored-by: Joshua Chen <[email protected]> * Demix invalid event from GlobalEventHandlers (#18451) * Demix slotchange from GlobalEventHandlers (#18225) * fix: various typos (#18483) * Fix typo (#18486) Remove stray 'a' in "contain a separator characters like the following" -> "contain separator characters like the following" * Fix link text (#18488) * Add missing period (#18487) * fix broken link (#18490) * Remove continuity descriptions from `steps(...)` (#18482) As per the spec (https://drafts.csswg.org/css-easing/#step-easing-functions), Figure 5, all step functions are right-continuous (i.e. You'd encounter solid dots approaching discontinuity from the right side). The `direction` keyword should strictly describe when the jumps (i.e. discontinuities) happen. * OpenType guide: font-variant-position is not mutually exclusive with <sup>/<sub> (#18459) Thank you! * Fix links for other references (#18501) * update a broken link (#18500) * Comment out ellipsis in code blocks (#18496) * Comment out ellipsis in code blocks (#18498) * Comment out ellipsis in code blocks (#18497) * Elaborate on destructuring assignment (#18495) * Elaborate on destructuring assignment * add headings * Mark kumascript code blocks js -> plain (#18493) * remove a broken link (#18499) * remove a broken link * Apply suggestions from code review Co-authored-by: Jean-Yves Perrier <[email protected]> Co-authored-by: Jean-Yves Perrier <[email protected]> * Demix pointer capture events from GlobalEventHandlers (#18450) * Demix pointer capture events from GlobalEventHandlers * Update files/en-us/web/api/element/lostpointercapture_event/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> * Add event properties section (still seems redundant...) * Add additional event properties section Co-authored-by: Jean-Yves Perrier <[email protected]> * Improvements to a few Number APIs (#18502) * Minor spread syntax rewrite (#18503) * Minor spread syntax rewrite * Update files/en-us/web/javascript/reference/operators/spread_syntax/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> Co-authored-by: Jean-Yves Perrier <[email protected]> * Window.open() rework (#18118) * first pass linting: remove xref macros, fix examples, fix code words * 2nd pass: remove broken/insecure links, fix remaining typos * Third pass - rework * fix flaws * Apply 1st set of suggestions Co-authored-by: Jean-Yves Perrier <[email protected]> * Taking @teoli2003 review into account Co-authored-by: Jean-Yves Perrier <[email protected]> * Fix broken block code in `Bracket notation` section (#18507) Add three missing backticks at ending of block code * Fix typo (#18508) * Fix missing parenthesis (#18509) * Mention string iteration goes by Unicode characters (#18504) * Mention string iteration goes by Unicode characters * add a flag example * Fix "repository of wavetables" text's broken link (#18510) * Add TBD content to files frontmatter and macros * Add TBD content to more empty files * TBD content * Add missing front matter data to files * Fix slug * Fix slugs * fix remaining writing guideline docs Co-authored-by: Ruth John <[email protected]> Co-authored-by: Prajwal Borkar <[email protected]> Co-authored-by: Joshua Chen <[email protected]> Co-authored-by: Davide Briano <[email protected]> Co-authored-by: Xavi Lee <[email protected]> Co-authored-by: A1lo <[email protected]> Co-authored-by: Zhang Yi Jiang <[email protected]> Co-authored-by: Onkar Ruikar <[email protected]> Co-authored-by: Hamish Willee <[email protected]> Co-authored-by: Paul Adenot <[email protected]> Co-authored-by: Jean-Yves Perrier <[email protected]> Co-authored-by: Lion Ralfs <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: simonvarey <[email protected]> Co-authored-by: Queen Vinyl Da.i'gyu-Kazotetsu <[email protected]> Co-authored-by: Nick Schonning <[email protected]> Co-authored-by: kokke <[email protected]> Co-authored-by: de-oz <[email protected]> Co-authored-by: Christopher Dignam <[email protected]> Co-authored-by: dshin-moz <[email protected]> Co-authored-by: J. S. Choi <[email protected]> Co-authored-by: Masahiro FUJIMOTO <[email protected]> Co-authored-by: SphinxKnight <[email protected]> Co-authored-by: Minh-Thuan Nguyen <[email protected]> Co-authored-by: Remco van 't Veer <[email protected]> Co-authored-by: Jeremy Pearson <[email protected]> Co-authored-by: Schalk Neethling <[email protected]>
* Move new contrib docs (#18041) * Move new contrib docs * underscores * renaming * removing redirect about * creating moving * experimental * does belong * editorial * code style guide * writing style guide * howto and seo * related_criteria for inclusion * file rename, link update * Updated Syntax for fetch-related pages (#17914) * Updated Syntax * port changes Co-authored-by: Joshua Chen <[email protected]> * Fix wrong example quote (#18458) * Unshorten code in method definition (#18457) * fixes #18444 * Update index.md Co-authored-by: Joshua Chen <[email protected]> * fix: correct the language of code examples (#18455) * Add `const` var declaration to FileSystemFileHandle sample code (#17930) * Add `const` var declaration * Update index.md * Update index.md Co-authored-by: Joshua Chen <[email protected]> * Update dom-examples links (#18462) * MediaRecorder: Update dom-examples links (#18464) * Update dom-example link (#18465) * update a broken link (#18466) * remove a broken link (#18467) * Update a broken link (#18468) * Fixes broken live sample (#18456) * Intl.NumberFormat - flyby fixes (#18258) * Fix `channelCount` semantics in `MediaStreamAudioSourceNode`. (#18472) * Fix `channelCount` semantics. This sparked confusion, e.g. in WebAudio/web-audio-api#2496. Source: I am this specification's editor. * Fix markup. * Fix parenthesis * Fix `channelCount` semantics. (#18473) * Fix `channelCount` semantics. This sparked confusion, e.g. in WebAudio/web-audio-api#2496. Source: I am this specification's editor. * Fix markup. * Fix parenthesis * Remove a few pointless references to internal slots (#18461) * Remove a few pointless references to internal slots * Update index.md * Apply suggestions from code review Co-authored-by: Jean-Yves Perrier <[email protected]> * simplify description Co-authored-by: Jean-Yves Perrier <[email protected]> * Fix syntax errors (#18475) * Fix syntax error Reported in https://github.com/orgs/mdn/discussions/158 (PR11) The macro just prints `Deprected` on the next line. * Fix in blobbuilder * Remove js annotation for webidl blocks Co-authored-by: Jean-Yves Perrier <[email protected]> * fix: syntax errors in JS example sections (v5) (#18442) * syntax fixes * fix remaining syntax errors * Adapt syntax box Co-authored-by: Jean-Yves Perrier <[email protected]> * Use diff instead of js to mark a diff block (#18477) * Update good vs bad example * fix a typo * marking it as diff * Bump @mdn/yari from 1.10.0 to 1.10.2 (#18479) * Correct a few usage of internal methods (#18476) * Change 'nodes' link to link directly to DOM nodes (#18480) The link to DOM 'nodes' currently links to the 'nodes' glossary page. I changed the link to DOM 'nodes' to directly link to the DOM nodes page. * Shorten Global object glossary entry (#18474) * FF103 Native Error types are serializable (#18384) * FF104 Native Error types are serializable * Fix error - this is in FF103, not 104 * Update files/en-us/web/api/web_workers_api/structured_clone_algorithm/index.md Co-authored-by: Joshua Chen <[email protected]> * Remove stack info from release note * Update files/en-us/mozilla/firefox/releases/103/index.md Co-authored-by: Joshua Chen <[email protected]> * Demix invalid event from GlobalEventHandlers (#18451) * Demix slotchange from GlobalEventHandlers (#18225) * fix: various typos (#18483) * Fix typo (#18486) Remove stray 'a' in "contain a separator characters like the following" -> "contain separator characters like the following" * Fix link text (#18488) * Add missing period (#18487) * fix broken link (#18490) * Remove continuity descriptions from `steps(...)` (#18482) As per the spec (https://drafts.csswg.org/css-easing/#step-easing-functions), Figure 5, all step functions are right-continuous (i.e. You'd encounter solid dots approaching discontinuity from the right side). The `direction` keyword should strictly describe when the jumps (i.e. discontinuities) happen. * OpenType guide: font-variant-position is not mutually exclusive with <sup>/<sub> (#18459) Thank you! * Fix links for other references (#18501) * update a broken link (#18500) * Comment out ellipsis in code blocks (#18496) * Comment out ellipsis in code blocks (#18498) * Comment out ellipsis in code blocks (#18497) * Elaborate on destructuring assignment (#18495) * Elaborate on destructuring assignment * add headings * Mark kumascript code blocks js -> plain (#18493) * remove a broken link (#18499) * remove a broken link * Apply suggestions from code review Co-authored-by: Jean-Yves Perrier <[email protected]> Co-authored-by: Jean-Yves Perrier <[email protected]> * Demix pointer capture events from GlobalEventHandlers (#18450) * Demix pointer capture events from GlobalEventHandlers * Update files/en-us/web/api/element/lostpointercapture_event/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> * Add event properties section (still seems redundant...) * Add additional event properties section Co-authored-by: Jean-Yves Perrier <[email protected]> * Improvements to a few Number APIs (#18502) * Minor spread syntax rewrite (#18503) * Minor spread syntax rewrite * Update files/en-us/web/javascript/reference/operators/spread_syntax/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> Co-authored-by: Jean-Yves Perrier <[email protected]> * Window.open() rework (#18118) * first pass linting: remove xref macros, fix examples, fix code words * 2nd pass: remove broken/insecure links, fix remaining typos * Third pass - rework * fix flaws * Apply 1st set of suggestions Co-authored-by: Jean-Yves Perrier <[email protected]> * Taking @teoli2003 review into account Co-authored-by: Jean-Yves Perrier <[email protected]> * Fix broken block code in `Bracket notation` section (#18507) Add three missing backticks at ending of block code * Fix typo (#18508) * Fix missing parenthesis (#18509) * Mention string iteration goes by Unicode characters (#18504) * Mention string iteration goes by Unicode characters * add a flag example * Fix "repository of wavetables" text's broken link (#18510) * Add TBD content to files frontmatter and macros * Add TBD content to more empty files * TBD content * Add missing front matter data to files * Fix slug * Fix slugs * fix remaining writing guideline docs Co-authored-by: Ruth John <[email protected]> Co-authored-by: Prajwal Borkar <[email protected]> Co-authored-by: Joshua Chen <[email protected]> Co-authored-by: Davide Briano <[email protected]> Co-authored-by: Xavi Lee <[email protected]> Co-authored-by: A1lo <[email protected]> Co-authored-by: Zhang Yi Jiang <[email protected]> Co-authored-by: Onkar Ruikar <[email protected]> Co-authored-by: Hamish Willee <[email protected]> Co-authored-by: Paul Adenot <[email protected]> Co-authored-by: Jean-Yves Perrier <[email protected]> Co-authored-by: Lion Ralfs <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: simonvarey <[email protected]> Co-authored-by: Queen Vinyl Da.i'gyu-Kazotetsu <[email protected]> Co-authored-by: Nick Schonning <[email protected]> Co-authored-by: kokke <[email protected]> Co-authored-by: de-oz <[email protected]> Co-authored-by: Christopher Dignam <[email protected]> Co-authored-by: dshin-moz <[email protected]> Co-authored-by: J. S. Choi <[email protected]> Co-authored-by: Masahiro FUJIMOTO <[email protected]> Co-authored-by: SphinxKnight <[email protected]> Co-authored-by: Minh-Thuan Nguyen <[email protected]> Co-authored-by: Remco van 't Veer <[email protected]> Co-authored-by: Jeremy Pearson <[email protected]> Co-authored-by: Schalk Neethling <[email protected]> * Page structures (#18644) Co-authored-by: Schalk Neethling <[email protected]> * docs: community docs (#18787) * docs: community docs Adds community docs to the `mdn` folder * Update files/en-us/mdn/community/contributing/getting-started/index.md * updating folder names Co-authored-by: Ruth John <[email protected]> Co-authored-by: Ruth John <[email protected]> * Contrib docs readthrough part 1 (#18994) * test change * Readthrough of contrib docs part1 * Move folders to howto and remove the duplicate inclusion_criteria (#19020) * Readthrough of contrib docs part2 (#19036) * chore: delete and redirect community docs (#19069) Deletes older documents and adds redirects to the new community docs. * adding sidebar for community docs (#19112) * adding sidebar for community docs * Update files/en-us/mdn/community/contributing/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> * Update files/en-us/mdn/community/contributing/our_repositories/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> * Update files/en-us/mdn/community/contributing/security_vulnerability_response/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> * Update files/en-us/mdn/community/contributing/translated_content/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> * Update files/en-us/mdn/community/discussions/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> * Update files/en-us/mdn/community/issues/content_suggestions_feature_proposals/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> * Update files/en-us/mdn/community/pull_requests/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> * Update files/en-us/mdn/community/index.md Co-authored-by: Gabe <[email protected]> * Update files/en-us/mdn/writing_guidelines/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> * Update files/en-us/mdn/community/users_teams/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> * Update files/en-us/mdn/community/contributing/getting_started/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> * Update files/en-us/mdn/community/issues/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> * Update files/en-us/mdn/community/mdn_content/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> * Update files/en-us/mdn/community/learn_forum/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> * Update files/en-us/mdn/community/mdn_content/pull_requests/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> * Update files/en-us/mdn/community/mdn_content/issues/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> * Update files/en-us/mdn/community/open_source_etiquette/index.md Co-authored-by: Jean-Yves Perrier <[email protected]> Co-authored-by: Jean-Yves Perrier <[email protected]> Co-authored-by: Gabe <[email protected]> * fix macros redirect * fix macros redirect * fix redirects * fix redirects * fix redirects * fix redirects * fix redirects * fix redirects * fix redirects * fix redirects * fix redirects * fix redirects * fix redirects * fix redirects * fix redirects * fix redirects * fix redirects * fix redirects * fix redirects * fix redirects * fix redirects * fix redirects * fix redirects Co-authored-by: Dipika Bhattacharya <[email protected]> Co-authored-by: Ruth John <[email protected]> Co-authored-by: Prajwal Borkar <[email protected]> Co-authored-by: Joshua Chen <[email protected]> Co-authored-by: Davide Briano <[email protected]> Co-authored-by: Xavi Lee <[email protected]> Co-authored-by: A1lo <[email protected]> Co-authored-by: Zhang Yi Jiang <[email protected]> Co-authored-by: Onkar Ruikar <[email protected]> Co-authored-by: Hamish Willee <[email protected]> Co-authored-by: Paul Adenot <[email protected]> Co-authored-by: Jean-Yves Perrier <[email protected]> Co-authored-by: Lion Ralfs <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: simonvarey <[email protected]> Co-authored-by: Queen Vinyl Da.i'gyu-Kazotetsu <[email protected]> Co-authored-by: Nick Schonning <[email protected]> Co-authored-by: kokke <[email protected]> Co-authored-by: de-oz <[email protected]> Co-authored-by: Christopher Dignam <[email protected]> Co-authored-by: dshin-moz <[email protected]> Co-authored-by: J. S. Choi <[email protected]> Co-authored-by: Masahiro FUJIMOTO <[email protected]> Co-authored-by: SphinxKnight <[email protected]> Co-authored-by: Minh-Thuan Nguyen <[email protected]> Co-authored-by: Remco van 't Veer <[email protected]> Co-authored-by: Jeremy Pearson <[email protected]> Co-authored-by: Ruth John <[email protected]> Co-authored-by: Gabe <[email protected]>
|
Thank you, @SphinxKnight , this is so much better! |
Summary
A proposal to fix #4583
Motivation
Have a sane a presentable
Window.open()page in 2022Supporting details
#4583
Related issues
Fixes #4583
Metadata