42

How can i change the title of javascript alert popup ?

Ruchi
  • 5,032
  • 13
  • 59
  • 84

6 Answers6

51

You can't, this is determined by the browser, for the user's safety and security. For example you can't make it say "Virus detected" with a message of "Would you like to quarantine it now?"...at least not as an alert().

There are plenty of JavaScript Modal Dialogs out there though, that are far more customizable than alert().

dShringi
  • 1,497
  • 2
  • 22
  • 36
Nick Craver
  • 623,446
  • 136
  • 1,297
  • 1,155
6

As others have said, you can't do that either using alert()or confirm().

You can, however, create an external HTML document containing your error message and an OK button, set its <title> element to whatever you want, then display it in a modal dialog box using showModalDialog().

Frédéric Hamidi
  • 258,201
  • 41
  • 486
  • 479
5

Simple: you can't.

cdhowie
  • 158,093
  • 24
  • 286
  • 300
2

You can't. The alert is a simple popup where you only can affect the content text.

If you want to change anything else, you have to use a different way of creating a popup.

Guffa
  • 687,336
  • 108
  • 737
  • 1,005
2

you cant do this. Use a custom popup. Something like with the help of jQuery UI or jQuery BOXY.

for jQuery UI http://jqueryui.com/demos/dialog/

for jQuery BOXY http://onehackoranother.com/projects/jquery/boxy/

sushil bharwani
  • 29,685
  • 30
  • 94
  • 128
2

It's not possible, sorry. If really needed, you could use a jQuery plugin to have a custom alert.

Omiod
  • 11,285
  • 11
  • 53
  • 59