CMS Development

markp
Mitglied

Javascript in HubSpot emails

lösung

I have built an email for a hubspot campaign that has links to an elearning module I have designed. I want the links to open in a NEW specific size window. Here is the code I am using:

 

<a href="#" onclick="window.open('http://elearning.berkshireassociates.com/talentacquisition/TAdemo_html5.html','_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0, width=895, height=520');return(false)"><strong>NEW Affirmative Action for Talent Acquisition</strong></a>

This works fine when previewing in Hubspot but when it is sent out it ignores the javascript. Does anyone have a clue or a better way to accomplish this task.

0 Upvotes
1 Akzeptierte Lösung
Jsum
Lösung
Autorität

Javascript in HubSpot emails

lösung

@markp,

 

You can't use javascript in emails. Even if a few clients allowed it, most don't so it is pointless. You are better off using target="_blank" to open in a new tab. 

 

You should also consider mobile compatability. Even if this could work, what would it do if someone clicked the link on mobile. 

 

If you are dead set on doing the popup then you can send the link to a page that has a script set up to open the specific size popup. I think you can even create the script to close the page after so the user would click the link, a new browser tab would open, this would trigger the popup, then the tab would close. You should still consider mobile functionality here though. You could use a javascript media query to decide whether to open the popup on desktop or redirect to the page. 

 

There might be other ramifications with this type of functionality as well, such as spam penalties. Users don't like popups and redirects and it could turn them off of your company. If I were you I would just send them to the page in a fresh tab and call it a day. 

Lösung in ursprünglichem Beitrag anzeigen

0 Upvotes
2 Antworten
Jsum
Lösung
Autorität

Javascript in HubSpot emails

lösung

@markp,

 

You can't use javascript in emails. Even if a few clients allowed it, most don't so it is pointless. You are better off using target="_blank" to open in a new tab. 

 

You should also consider mobile compatability. Even if this could work, what would it do if someone clicked the link on mobile. 

 

If you are dead set on doing the popup then you can send the link to a page that has a script set up to open the specific size popup. I think you can even create the script to close the page after so the user would click the link, a new browser tab would open, this would trigger the popup, then the tab would close. You should still consider mobile functionality here though. You could use a javascript media query to decide whether to open the popup on desktop or redirect to the page. 

 

There might be other ramifications with this type of functionality as well, such as spam penalties. Users don't like popups and redirects and it could turn them off of your company. If I were you I would just send them to the page in a fresh tab and call it a day. 

0 Upvotes
markp
Mitglied

Javascript in HubSpot emails

lösung

Thanks figured that out, trying to convice staff we need to send them to a landing page.

0 Upvotes