Share via


How to open link to pdf file in new tab using html

Question

Tuesday, June 1, 2010 1:37 AM

I have an html page which contains link to open pdf file. however this link opens in adobe reader when i click on it. I have set target property to blank. but it doesnt work either.
I want to open this pdf file in new tab in the same window.

All replies (6)

Tuesday, June 1, 2010 2:57 AM ✅Answered

<a href="somefile.pdf" target="_blank">My PDF file</a>

It is becuz your browser dont have plug-in for display pdf file in browser.

add "Adobe Acrobat" plugin in browser.


Tuesday, June 1, 2010 4:38 AM ✅Answered

Agreed wit Coool...You cant open pdf if you dont have pdf reader installed. In that case if you write above codes it will give you an option to save.

Still one thing you can try you can open the pdf in Iframe if you want

see the following code

aspx html code :

<iframe id="top_frame" align="top" runat="server" scrolling="auto" frameborder="1" width="800px" height="500px" style = "border:solid 2px black;"/>

C# code behind:

top_frame.Attributes.Add("src", url);

here url is the pdf file virtual path...you can give the using map path if the pdf is inside your project


Tuesday, June 1, 2010 6:36 AM ✅Answered

well You can install adobe acrobate plugin from this URL.

https://addons.mozilla.org/en-US/firefox/browse/type:7


Tuesday, June 1, 2010 3:07 AM

Open links in tab is set by user in browser..

That behavior is configured by the user and, as far as I know, only by the user.

Not possible to handle that behavior by javascript n all...

if user browser has settings that allow new window in tab ..it will open otherwise not..

see  this for setting : http://helpdeskgeek.com/how-to/force-ie-to-open-link-in-new-tab/

Now you can not take control over this by coding..


Tuesday, June 1, 2010 3:56 AM

**thanks "Contributor". I am not having Adobe acrobat plug in to open link of pdf in new tab
**


Tuesday, June 1, 2010 4:10 AM

As you don't have adobe acrobat plugin installed, there is no way to open pdf file in browser. Why don't you just install acrobat plugin?