javascript not working inside email

帅比萌擦擦* 提交于 2021-02-08 06:44:28

问题


I am sending an email from my SAP System to gmail. The body is html and javascript based content. Now, the requirement is to create a new url window onclick of a button or a link inside the email which will open a web page in a popup window.

So, when i am testing it within SAP, it is working correctly but when i am testing it within the gmail application, it is calling the URL in a new Tab(Full Page). As it is just an informational window, i want to keep it as small as possible.

Here is my code for the email content

<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">function target_popup(form){    
window.open("","formpopup","width=3000,height=40,resizable,scrollbars");
form.target="formpopup";}
</script>
<form action="https://testapp.html"  onsubmit="target_popup(this)">
<input type="submit" value="Go to Google" />
</form>
</body>
</html>                                                                                                                                                                             

回答1:


All email clients have (and must have) a strict policy against running any Javascript found in emails.

This is a strong security requirement, you will not get around it. Which is good. You can only place Javascript on the target site, not in the email.



来源:https://stackoverflow.com/questions/39551120/javascript-not-working-inside-email

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!