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
Leave a Reply