Is JavaScript supported in an email message? Is JavaScript supported in an email message? javascript javascript

Is JavaScript supported in an email message?


http://en.wikipedia.org/wiki/Comparison_of_e-mail_clients

Old clients, such as Lotus Notes, Mozilla Thunderbird, Outlook Express, and Windows Live Mail all seem to have supported some sort of JavaScript execution. Nothing else does.

It seems like a bad idea security-wise, so I would expect this to be a feature that won't always be around, even in these clients.


Short answer

No


Descriptive answer

It depends. But the email is not guaranteed to behave in the way you want it to. Different email clients handle JS differently. Most of the newer email clients do not support any of it since it is potentially very dangerous to support script execution in a desktop application which contains so much of your personal info.

I had a use case where I needed to use JS in an email. I tried out on the web client of outlook and desktop client as well, and it turns out outlook just wipes out the script part of your HTML email. There might be some other email client which does support JS execution, but given that you cannot control the client where your email would be viewed in the client machine, it's not a good idea to embed any scripts in the HTML email.

Its advised to keep your HTML email as simple as possible, no JS, and the least CSS you can do with (because, again, different email clients have varying support for CSS as well) eg: outlook's web client was not even recognizing an HTML button tag in the email. I had to use an anchor tag and some CSS on top of it to mimic the display of a button.


Bottom line - don't rely on Javascript when working with HTML email content.


No, generally speaking email readers do not allow javascript.