I have a PDF file embedded with the page and I have a download link which is used to download that pdf file. When I click on the download link, it will not work since it is the same url as with the embedded pdf; and because the adobe reader is already loaded in the browser it will automatically opens in a new window and the embedded pdf will be unloaded.

To prevent this scenario, we can use the following mechanism. First create a hidded iFrame in the same window using the following code.
<iframe style="DISPLAY: none" src="/" name="iframe1"></iframe>;
Now make a small change to your download link so that the url target is pointing to the hidden frame as shown below..
<a href="http://www.yoursite.com/..." target="iframe1">Download</a>
This will solve the problem. However this method has not been tested with the browsers other than Internet Explorer, Firefox and Netscape.

Like it on Facebook, Tweet it or share this article on other bookmarking websites.

No comments