Wednesday, May 7, 2014

How to open Document Library Item/InfoPath Form in New Window ???

Document libraries are collections of files that you can share with team members on a Web based on Microsoft Windows SharePoint Services. 

Create document library and uploaded files in it or open existing file, its opening in the same browser. There is no inbuilt feature in SharePoint to set it to open in new window.
SharePoint uses window.location to navigate to the new link, So the link always open in current window instead of a new window.
As a solution, you can override the STSNavigate function to change the behavior; here is the code sample to override it in AllItems.aspx.

<asp:content contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">
       <SharePoint:RssLink runat="server"/>
      
       <Script>
       function STSNavigate(Url){
              window.open(STSPageUrlValidation(Url),"_blank");
       }
       </Script>
</asp:content>

Instead of this you can add content editor web part and add java script code to it.

No comments:

Post a Comment