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.
Even if you could, alert()
boxes are generally modal - so any page opened from one would have to open in a new window. Annoying!
alert("There was an error. Got to this page to fix it.\nwww.TheWebPageToFix.com");
That's the best you can do from a JavaScript alert()
. Your alternative option is to try and open a new tiny window that looks like a dialog. With IE you can open it modal.
If you really wanted to, you could override the default behavior of the alert()
function. Not saying you should do this.
Here's an example that uses the YUI library, but you don't have to use YUI to do it:
YUI-based alert box - replace your ugly JavaScript alert box
You can't. Alert boxes don't support html. You should display the error as part of the page, it's nicer than JS alerts anyway.
You can't - but here are some options:
window.open()
- make your own dialogprompt()
and instruct the user to copy the urlconfirm()
to ask them)div
on your page with a [FIX IT] button and unhide itOr use window.open and put the link there.