You can't. Or at least, I really, really hope you can't.
Javascript does not belong on e-mails. If it did, then people could receive nightmarishly evil emails that open an infinite number of alerts, redirect them to an offsite page, read your emails and your contact list, and so on. There are too many security repercussions of allowing Javascript inside of e-mails.
For this reason, gmail blocks javascript inside of emails, as any respectable e-mail client should.
Html emails shown in browser email clients will be stripped of all javascript so you can try but it won't work. Other clients such as outlook (which uses MS Word to render the html) also strip (or ignore?) the javascript. It's a vulnerability to allow it.
Think of this scenario: javascript on a page has full access to make ajax calls. You could use JS to iterate through all your emails and contacts etc and then send them on to a foreign server.
Allowing JS to run in emails would be the equivalent of allowing XSS.
发布评论
评论(2)
你不能。或者至少,我真的真的希望你不能。
JavaScript 不属于电子邮件。如果确实如此,那么人们可能会收到噩梦般的邪恶电子邮件,这些电子邮件会打开无限数量的警报,将其重定向到异地页面,阅读您的电子邮件和联系人列表,等等。允许在电子邮件中使用 JavaScript 会带来太多的安全影响。
出于这个原因,gmail 会阻止电子邮件中的 javascript,就像任何受人尊敬的电子邮件客户端所做的那样。
You can't. Or at least, I really, really hope you can't.
Javascript does not belong on e-mails. If it did, then people could receive nightmarishly evil emails that open an infinite number of alerts, redirect them to an offsite page, read your emails and your contact list, and so on. There are too many security repercussions of allowing Javascript inside of e-mails.
For this reason, gmail blocks javascript inside of emails, as any respectable e-mail client should.
浏览器电子邮件客户端中显示的 Html 电子邮件将被删除所有 JavaScript,因此您可以尝试,但它不会工作。其他客户端,例如 Outlook(使用 MS Word 呈现 html)也剥离(或忽略?) javascript。这是一个允许它的漏洞。
想想这个场景:页面上的 javascript 具有进行 ajax 调用的完全访问权限。您可以使用 JS 遍历所有电子邮件和联系人等,然后将它们发送到外部服务器。
允许 JS 在电子邮件中运行就相当于允许 XSS。
Html emails shown in browser email clients will be stripped of all javascript so you can try but it won't work. Other clients such as outlook (which uses MS Word to render the html) also strip (or ignore?) the javascript. It's a vulnerability to allow it.
Think of this scenario: javascript on a page has full access to make ajax calls. You could use JS to iterate through all your emails and contacts etc and then send them on to a foreign server.
Allowing JS to run in emails would be the equivalent of allowing XSS.