.. title: Internet Explorer Ampersand Bug with prompt() .. slug: ie_ampersand_bug .. date: 2007-11-17 05:09:47 UTC .. tags: javascript

I just discovered an inconsistency in how Internet Explorer (6 and 7) handles ampersands with the prompt() built-in function.

Try the following in Firefox and then again in IE6 or IE7.


FF and IE behave identically for alert() but for prompt() both IE6 and IE7 fail to show an ampersand unless "&&" is supplied. Very strange.

In case you're wondering, &amp; doesn't help either; it isn't translated for popups in any of the browsers.

Is this a known problem? I haven't been able to track down other reports of the issue.

Short of doing browser specific hacks, or just not using prompt(), I can't see a way of getting consistent behaviour across browsers. How craptastic. The joys of web development...