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

fix: Add sandbox attrs to live samples that call prompt() and confirm() #38253

Merged
merged 10 commits into from
Feb 20, 2025
Prev Previous commit
Next Next commit
feat(api): Don't mix quote styles in macros
bsmth committed Feb 20, 2025
commit 05eb247a245c64c988f689164d5e858b86d5af93
Original file line number Diff line number Diff line change
@@ -138,7 +138,7 @@ function greet() {
button.addEventListener("click", greet);
```

{{EmbedLiveSample('string-concat', , '50', , , , , "allow-modals")}}
{{EmbedLiveSample('string-concat', , '50', , , , , 'allow-modals')}}

Here, we are using the {{domxref("window.prompt()", "window.prompt()")}} function, which prompts the user to answer a question via a popup dialog box and then stores the text they enter inside a given variable — in this case `name`. We then display a string that inserts the name into a generic greeting message.

Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ button.addEventListener("click", updateName);
You can click "Play" to see and edit the example in the MDN Playground.
Try clicking on the text label to see what happens.

{{EmbedLiveSample('string-concat-name', , '80', , , , , "allow-modals")}}
{{EmbedLiveSample('string-concat-name', , '80', , , , , 'allow-modals')}}

JavaScript can do a lot more than that — let's explore what in more detail.

2 changes: 1 addition & 1 deletion files/en-us/web/api/window/prompt/index.md
Original file line number Diff line number Diff line change
@@ -65,7 +65,7 @@ signButton.addEventListener("click", () => {
});
```

{{EmbedLiveSample('prompt', , , , , , , "allow-modals")}}
{{EmbedLiveSample('prompt', , , , , , , 'allow-modals')}}

### Prompt messages and default values