Open doclib(s) documents in a new window

on September 18, 2006

The is a very easy hack to perform, but how hard was it for me to find documentation on this! ahahah.

We can do it in a way that you need to add a field in all doclib to enable or disable the feature. In my case that was useless as we need this everywhere and we do not want to play around we this. But I respect thisd solution and if you feel that it may fit your needs, follow this link to read the artcile.

than, there are another solution implying to put a web part in every pages having a list where you want to open document in a new window. On the same method as for my logout implementation they script the page to add the target="_blank” in all the href. If that fit your needs follow this link.

Now… If you want to add 15 caracters in one file and fix that thing for all your WSS Sites, follow thses instructions:

1. Open:

C:Program FilesCommon FilesMicrosoft Sharedweb server extensions60TEMPLATE1033STSXMLOnet.xml

2. If the file as never been altered, scroll down to line 276 (Line 7 in the following code snippet):

Code:

<LookupColumn Name="FileLeafRef" HTMLEncode="TRUE"/>
<HTML><![CDATA[</A>]]></HTML>
</Default>
</Switch>
</Then>
<Else>
<HTML><![CDATA[<A onfocus="OnLink(this)" HREF="]]></HTML>
<Field Name="EncodedAbsUrl"/>
<HTML><![CDATA[" onclick="DispDocItemEx(this,']]></HTML>
<ServerProperty Select="HtmlTransform"/>
<HTML><![CDATA[',']]></HTML>
<ServerProperty Select="HtmlTrAcceptType"><Column Name="File_x0020_Type"/></ServerProperty>

3. You just need to add the “target” parameter as you can see here:

Code:

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

4. Save and IISRESET your server. Because the Site definitions are cached.

5. Open your site and test. In my case, it worked at my first try without a glitch.

Note that if you need this through other kinf of Site Definition, you’ll need to perform this modif in the other Onet.xml from the other Site Def Folder.

Enjoy.

ShareThis