Disclaimer:
Ok I know that this is being discussed in the thread linked below, but it isn’t solving my problem.
How to make onclick automatically through onload function
Issue:
I want to include a ‘tweet’ button in an HTML email. Obviously since you cannot run js in most clients this isn’t feasible. My theoretical solution to have an image link that says tweet that opens a new window who’s sole purpose is to house and fire a jQuery click event on an actual tweet button.
I’m trying to use this bit of simple syntax to no avail:
$(document).ready(function() {
$('#autoClick2').trigger("click");
});
with this <a id="autoClick2" href="mailto:nothing@nothing.com">ugh</a>
I also tried:
$(document).ready(function() {
$('#autoClick2').click();
});`
No dice on either, anyone have an idea?
That seems a roundabout way of accomplishing your task, which is, if I understood correctly, simply to tweet something. Why not simply make that in-email “Tweet this” image a link to Twitter’s share URL? Here’s a quick (and dirty) example using the URL from this question:
Implemented:
http://a4.twimg.com/images/favicon.ico Tweet this
For a more refined example, see the “Build Your Own Tweet Button” section of Twitter’s development documentation.