title: dynamically set anchor reference will not show but download
body: <p>I am facing a roblem where html page anchor href set in html opens a pdf in the same window BUT when href is set in javascript it just downloads the document. I need to open the dynamically-set doc in current browser window. Page uses java query 1 7 1 js. The href is tried and true.</p>
  
  <p>forcing target="_self" does not help, it is default anyways
  any function of onclick applied to the anchor tag fires but is ignored. tried regular js as well as jquery
  happens in IE, Safari, Chrome, did not try others but not interested for now</p>
  
  <p>I am open to try any suggestions.</p>
  
  <p>not moodyfying the above to be honest in respect to the kind person who answered first.</p>
  
  <p>here is what I found thanks to the answer: 
  It doesn't matter if the link is set dynamically, nothing wrong with the pdf document, problem seems to be the location of the doc.
  When I reference that doc in one domain it opens in current browser just fine, only the new domain location creates this problem ( I copied the old document there ).</p>