Friday, April 15, 2011

Open Links in a new window in SharePoint 2010

Beleive it or not, but SharePoint 2010 OOB does not support opening links in a new browser window when using the URL field/column. The best work around is to:
  1.  open the page with the XSLTViewWebpart that displays the hyperlinks in SharePoint designer.
  2. Now Click on Design tab on SharePoint Designer and select "Customize XSLT > Customize Entire View".
  3. Then locate your <a> tag and you would note that the attribute value set to href='{$url}'. Beside this attribute include the following - onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;"
  4. Save and Preview the page in browser and eureka the links for the above web part will now open in new browser window

3 comments:

damo said...

Hello, I tried your solution ( as below) and was not able to get it to work... am I doing it wrong?

damo said...

not to worry I used target="_blank" and is works fine. Thank you for pointing me in the right direction

Unknown said...

Thanks! But simple and easiest solution is: Create a Site column of "Hyperlink with formatting and constraints for publishing" type and add it in your list, which enables you to specify "Open in New Window" Option!

There are few more possible solutions, including JavaScript, JQuery, SharePoint Designer, List Schema Edit to make SharePoint Link list open in new window at SharePointDiary.com -

SharePoint Link list: Open in a New Window