Triggering a target=_blank link from JavaScript
<p>This is a nasty one.</p>

<p>I have an external link.</p>

<pre><code>&lt;a href="http://www.example.com" target="_blank"&gt;
</code></pre>

<p>now I want to track a Google AdWords conversion every time that link gets clicked.</p>

<p>To do that, I add a <code>click</code> event that loads a Google image. The image counts the conversion. To make absolutely sure the image gets loaded before the user leaves, I use the image's <code>load</code> event to proceed to the original link's target.</p>

<pre><code>$("#linkname").click(function() {

 var element = document.createElement("img");
 element.onload = function() { ..... };
 element.setAttribute("src", "http://www.googleadservices.com/....");
 document.body.appendChild(element); 

 });
</code></pre>

<p>This will work fine using <code>location.href</code>. However, it won't work for <code>target="blank"</code> links.
 I'm baffled as to <em>what to put into the onload function in order to open a new window.</em></p>

<ul>
<li><p>I can't use <code>window.open</code> because it will be caught by pop-up blockers (Because it's located in the image's <code>onload</code> event, it looks like a purely programmatical call that has nothing to do with the link being clicked.) Also, calling window.open without any options does not give me any controls in Google Chrome.</p></li>
<li><p>I can't make the <code>click</code> event continue its normal course because I have to wait until the image is loaded, which is an asynchronous operation!</p></li>
</ul>

<p>What I would need, essentially, is a way to open a <code>target="_blank"</code> link programmatically, something that may not be possible because it could be circumvented by pop-up-blocker-breakers.</p>

<p>Alternatively, I would need a way to reliably count hits while letting the link's original <code>click</code> event continue as it's supposed to.</p>

<p>Does anybody have an idea what to do?</p>
