Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>                                                                                                                                                                             
like image 632
Sourav Das Avatar asked Jun 08 '26 05:06

Sourav Das


1 Answers

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.

like image 61
fdreger Avatar answered Jun 10 '26 09:06

fdreger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!