Snehal Gupta
Snehal Gupta

Reputation: 344

How to open pdf in new blank pop up window and download

I am trying to reproduce a scenario for debugging some issue for which I need to click on date which opens a new pop up window which is blank and pdf gets downloaded in that window. So far I am only able to download pdf in same window it does not open in new window and then download.

HTML code tried:-

<a href="javascript:open('C://Users//abcd//Desktop//freeformatter-decoded.pdf','mypopuptitle','width=600,height=400')"  id="1" style="cursor: pointer; color: rgb(14, 87, 193); text-decoration: none;">First acc</a>

<a target="_blank" href="C://Users//abcd//Desktop//freeformatter-decoded.pdf">First acc</a>

Below screenshot shows the scenario which I want to recreate:-

enter image description here

On click on 04/05/2018 a pdf should get downloaded in new pop up window. Note that pop window is blank it just downloads pdf. Please help in writing html/javascript for above. I need to recreate exact use case.

Upvotes: 1

Views: 1909

Answers (2)

Suhag Lapani
Suhag Lapani

Reputation: 695

<a target="_blank" href="C://Users//abcd//Desktop//freeformatter-decoded.pdf" download>First acc</a> using download attribute you can download

Upvotes: 1

deen
deen

Reputation: 2305

You can use following code to open pdf url in another window-

window.open("url/sample.pdf", "_blank");

Upvotes: 0

Related Questions