简体   繁体   English

如何将javascript添加到电子邮件中?

[英]How can I add javascript to an the email?

Is it possible to have a ajax button inside email? 电子邮件中是否可以有一个Ajax按钮? I want to add a button similar to the buttons inside a google calendar meeting invitation email. 我想添加一个类似于Google日历会议邀请电子邮件中的按钮的按钮。

Or is there any alternative option??? 还是有其他选择???

Don't count on it. 不要指望它。 Most if not all mail clients will refuse to run Javascript within an e-mail. 大多数(如果不是全部)邮件客户端将拒绝在电子邮件中运行Javascript。

If you want to include buttons, insert images with different links to a public web page of yours. 如果要包含按钮,请在您的公共网页上插入带有不同链接的图像。 Also, do include the button images within the mail message itself (and reference them by Content-ID ), since many mail clients nowadays even refuse to load remote images. 另外,不要在邮件消息本身中包含按钮图像(并通过Content-ID引用它们),因为当今许多邮件客户端甚至拒绝加载远程图像。

This is exactly what Google Calendar does. 这正是Google日历所做的。 Of course, Gmail recognizes invitation attachments ( text/calendar ), and so provides its own interface for the yes/no/maybe buttons. 当然,Gmail可以识别邀请附件( text / calendar ),因此为yes / no /也许按钮提供了自己的界面。

Probably not, it depends on mail client but I would be incredibly suprised if I saw any that allowed scripts as this opens the floodgates for huge security compromise risks. 可能不是,这取决于邮件客户端,但是如果我看到允许脚本的脚本,那将令我感到非常惊讶,因为这为巨大的安全隐患打开了闸门。

Edit 编辑

Your best option would probably be to look at support for iframes, again though, I would be suprised if many mail clients allowed use of this element. 最好的选择可能是查看对iframe的支持,不过,如果许多邮件客户端允许使用此元素,我将感到惊讶。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM