Javascript floodlight tracking iframe leaves browser window blank, please help!

Posted by Ben Paton on Stack Overflow See other posts from Stack Overflow or by Ben Paton
Published on 2010-04-17T00:03:37Z Indexed on 2010/04/17 0:13 UTC
Read the original article Hit count: 656

Hello,

I have been asked to implement a javascript floodlight tag onto my site which is to be called everytime a customer downloads a pdf file. I have tried to implement this as follows:

<script type="text/javascript">
function appForm() {
 var axel = Math.random() + "";
 var a = axel * 10000000000000;
 document.write('<IFRAME SRC="http://fls.doubleclick.net/activityi;src=1234567;type=count123;cat=123do456;ord=1;num='+ a + '?" WIDTH=1 HEIGHT=1 FRAMEBORDER=0></IFRAME>');
 return false;
}
<a href="appForm.pdf" target="_blank" onClick="appForm();">Download PDF</a>

This seems to almost work. The pdf file opens in a new window. But the window where you clicked the download link turns blank. Is there a way of opening this tracking iframe and then having the pdf opening without the parent window going blank? Your help will be very much appreciated on this.

© Stack Overflow or respective owner

Related posts about document.write

Related posts about pdf