Opening Document Library PDF Items in MOSS 2007 in a New Window

In SharePoint 07 document library do not open PDF files in a new window. When I open the document, the PDF file is opened to same browser session. User often try to close the document by closing the browser and this is a problem.

I found three solutions,

First Solution : Modify client Adobe Reader setting.

Adobe Reader has an option called “Disable display of PDF in browser” that you need to change on your clients.
In Adobe Reader 9 :

1. Edit – Preferences
2. Category : Internet
3. Uncheck the “Display PDF in browser ”

But unfortunately you need to do that on every client computers.

Second Solution : Modify XSLT.

Edit the document library in SharePoint Designer.
1. Open the site in SharePoint Designer and then open the document library allitems.aspx.
2. Right-click the document library web part and select “Convert to XSLT data view”.
3. Locate the name column, you will see this tag “<A onfocus="OnLink(this)" HREF="{@FileRef}"….. ”, add “target=”_blank”” in tag.
4. After this, the documents will be opened in a new window.

But unfortunately you need to do this to all document libraries to open documents in new window.

Third Solution : Modify ONET.XML.

1. Open the folder: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL\XML

Apparently there is now a “global” folder for site definition files, I am still trying to understand the mapping of things from SPS 2003 and MOSS 2007.

2. Find and open the file named “ONET.XML” in your favorite XML/text editor (good old notepad for me please)

3. On line 693 you will find this line of XML:

<Else><HTML><![CDATA[<A onfocus=”OnLink(this)” HREF=”]]></HTML>

Changing this line to as shown below will change the behavior of the textual links to open in a new window

<Else><HTML><![CDATA[<A onfocus=”OnLink(this)” target=”_blank” HREF=”]]></HTML>

4. On line 838 you will find this similar line of XML:


Changing this line to as shown below will change the behavior of the image icon links to open in a new window

<Else><HTML><![CDATA[<A TABINDEX=-1 target=”_blank” HREF=”]]></HTML>

5. Save changes do an IISRESET and you should be good to go. Of course if you are in a medium or large farm scenario you will need to perform these steps for each front-end web server

I would recommend the third solution.



Diganta is an experienced Technical Program Manager with a passion for technology. He has architected and developed software for more than a decade for a broad range of industries. Diganta is a founder of two online IT businesses. He is a certified AWS Solutions Architect, AWS Certified Developer, Professional Scrum Master (PSM I), Professional Scrum Developer (PSD I) and ITIL Certified. He has presented at Microsoft Tech.Ed, Microsoft AppFest and Ark Group Intranet conference in the past. He attends AWS Seattle Official Events and Seattle AWS Architects-Engineers. He likes to help, mentor, and manage software development teams to improve and produce great software.

Tagged with:
Posted in SharePoint

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.