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:

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

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.

Reference

http://www.jjfblog.com/2006/12/one-issue-that-came-up-during-recent.html

http://social.technet.microsoft.com/Forums/en/sharepointadmin/thread/9db08c4a-b53c-419a-84f8-001c194d1311

http://social.technet.microsoft.com/Forums/en-US/sharepointadmin/thread/530e2ea1-d77d-491c-935f-04f536e439a5

Diganta Kumar is an experienced Technical Program Manager with a passion for technology. He has architected and developed software for over a decade for a broad range of industries. Diganta is a founder of two online IT businesses. He likes to help, mentor, and manage software development teams to improve and produce great software. He currently works as a Principal Program Manager for Microsoft. Before joining Microsoft, he was with AWS for five years, where he managed large cross-functional programs on a global scale.

Tagged with:
Posted in SharePoint

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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.