Sourav Das
Sourav Das

Reputation: 1008

javascript not working inside email

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>                                                                                                                                                                             

Upvotes: 2

Views: 4046

Answers (1)

fdreger
fdreger

Reputation: 12505

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.

Upvotes: 13

Related Questions