View pdf file in a new window via javascript

I have the following php code:

<span><?php if (!empty($post_file)){echo "PDF FILE: &nbsp&nbsp&nbsp&nbsp&nbsp <a href='./pdf/$post_file' title='PDF' onclick='pdfOpen();' rel='nofollow'><img src='./images/acrobat-reader.png' height='22px;' width='19px;'></a>";}?></span>

and the Javascript function for the onclick event:

<script>
function pdfOpen(){
   window.open(this.href,'win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');
   return false; 
    
};
</script>

The problem is when i clicked the img the pdf file open normally in the initial page and then opens a new window as I set in my Javascript code but the new window is blank…No url, no pdf, nothing… How I can fix it? Thanks a lot for your effort

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.