0

I have tried open(alert("Hi!")

I was also wondering how you would put a prompt response from someone into the alert on the new blank window as well. I tried

let answer = prompt("What is your fave drink?")
if (answer ==null){
window.alert(answer)
else{
window.open()
hamster
  • 3
  • 3
  • Does this help? https://stackoverflow.com/questions/32357312/running-javascript-in-new-window-open – async await Jul 15 '21 at 22:37
  • Does this answer your question? [Running Javascript in new window.open](https://stackoverflow.com/questions/32357312/running-javascript-in-new-window-open) – Kinglish Jul 15 '21 at 22:43

1 Answers1

0

window.open() accepts a URL as an argument You would need another page to open the alert, and pass the URL of that page, for example: window.open("https://mypage.com/alert")

Adam
  • 97
  • 3