default sound for javascript alert() box
I've noticed that javascript alert() box plays the system sound "exclamation" found in Control Panel > Sound > Sounds tab > Windows > Exclamation. So changing the "exclamation" wav file there changes the sound the alert box plays.
I've tested this in FF 3+ and IE8+ (works), but doesn't appear to work in Chrome 5+. I've only tested in Windows 7. My question is this: do开发者_StackOverflow社区es changing the "exclamation" sound always change the sound that the javascript alert box plays, for example from Windows XP - Win7 and for all the modern browsers (chrome excluded)?
Here is a simple alert box to test on -> http://www.javascripter.net/faq/alert.htm
I guess I'm looking for a better explanation of how the alert box works, how the browser decides which sound to play (or is it the OS?) and how to ensure some compatibility across browsers. Some google searches weren't very illuminating on the subject.
The reason that it works that way is that they (at least IE) use the win MessageBox api to generate the pop-up, so changing the system file changes it for ALL applications that use the MessageBox api. Chrome does not us this API for sure. So, to answer your question, if you want a uniform sound across browsers, dont rely on the default.
Yes, in windows it's not just browser alerts that use the same sound. They are all using the same sound file.
I guess Microsoft put it there for IE (and other windows form alerts) and Firefox hijacked it because, why the hell not.
精彩评论