I know it is a somewhat controversial topic of whether or not to force a browser to open new window. But I have decided in the case of pdf files I will. After selecting the link I want to warn the user by bringing up that dialogue letting them know that they can save the pdf to disk or open it with Adobe Reader or cancel. Could somebody please help me with this problem. I don't want to use anything like a target attribute. I have java and css at my disposal.

Thank you for any consideration,

Recommended Answers

All 3 Replies

I'm a lousy web designer, but it doesn't seem like you'd need to do anything special here. Just make it a download and it will give the user that option in a trusted system window. I always get nervous when a webpage tries to mimic something that my system would do without it, so having a webpage with those same options would be a big turn-off for me.

Thank you for taking the time to respond. I often don't make myself as clear as I would like. I don't want to make my own dialogue. I want to learn how to use the standard. Here are a couple of examples. The first is mine and opens a pdf in the browser and the second is one I would like to emulate. I know I may very well be missing something obvious.

Goto http://www.starprecision.com/laser.shtml and click "Click Here for an Equipment Overview". This opens http://www.starprecision.com/pdf/FacilitiesList.pdf in the same browser window.

An example of what I would like can be seen by selecting the link on the page http://www.starprecision.com/testopenpdf.html which brings up the dialogue box to which I was referring. Ironically, although incidental, on my system this particular file will not actually open. It is the process using the dialogue box I am trying to implement,

Thank you again for your help,

After some research and testing of your source code, there doesn't seem to be any way to point at a PDF file directly and force it to bring up the download prompt, it's completely at the disgression of the browser, however it can often be done with Java script (the results vary). Here's an example I found on the web of how to do this using Java:

 function downloadme(x){
    myTempWindow = window.open(x,’’,’left=10000,screenX=10000’);

<a href=javascript:downloadme("/test.pdf");>Download this pdf</a>

and a more simple "conceptual" version:

myTempWindow = window.open("thePdfFile.pdf","SaysaMe");

With that said, the reason it works in the second example and not the first is actually the format of the link. You're not actually pointing at the file you're pointing at it's directory, and that seems to be doing the job.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.