-
Notifications
You must be signed in to change notification settings - Fork 23.1k
Fix JS button example (#42503) #42509
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
base: main
Are you sure you want to change the base?
Conversation
docs(HTML): add note about sandboxed download in <a> example mdn#42463
This PR fixes the first JavaScript code example on the page: 'Player 1: Chris' button. - Added <script src="script.js"> below button in HTML - Corrected JS order: select button first, then define function and add event listener - Ensures dynamic behavior works in MDN Playground
|
|
||
| To save a {{HTMLElement("canvas")}} element's contents as an image, you can create a link where the `href` is the canvas data as a `data:` URL created with JavaScript and the `download` attribute provides the file name for the downloaded PNG file: | ||
|
|
||
| > **Note:** The "Download my painting" link will not work in MDN live examples because downloads are disabled in sandboxed iframes. |
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.
[mdn-linter] reported by reviewdog 🐶
| > **Note:** The "Download my painting" link will not work in MDN live examples because downloads are disabled in sandboxed iframes. | |
| > **Note:** The "Download my painting" link will not work in MDN live examples because downloads are disabled in sandboxed iframes. |
|
|
||
| To save a {{HTMLElement("canvas")}} element's contents as an image, you can create a link where the `href` is the canvas data as a `data:` URL created with JavaScript and the `download` attribute provides the file name for the downloaded PNG file: | ||
|
|
||
| > **Note:** The "Download my painting" link will not work in MDN live examples because downloads are disabled in sandboxed iframes. |
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.
[markdownlint] reported by reviewdog 🐶
error search-replace Custom rule [gfm-alert: Use the GFM syntax: https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Howto/Markdown_in_MDN#notes_warnings_and_callouts] [Context: "column: 1 text:'> Note:'"]
|
Preview URLs Flaws (1)URL:
(comment last updated: 2025-12-23 11:15:24) |
Fixes #42503
const buttondeclaration before theupdateNamefunction so the JS example works correctly.<script defer src="script.js"></script>to ensure JS runs after page loads.