How do I put a link to a webpage in a JScript Alert dialog box?

前端 未结 7 1717
遥遥无期
遥遥无期 2021-01-13 22:28

I would like to put a link to a webpage in an alert dialog box so that I can give a more detailed description of how to fix the error that makes the dialog box get created.

7条回答
  •  渐次进展
    2021-01-13 23:20

    You can't - but here are some options:

    • window.open() - make your own dialog
    • Use prompt() and instruct the user to copy the url
    • Use JavaScript to just navigate them to the url directly (maybe after using confirm() to ask them)
    • Include a div on your page with a [FIX IT] button and unhide it
    • Use JavaScript to put a fix it URL into the user's clipboard (not recommended)

提交回复
热议问题