SharePoint Link list: Open in a New Window

In SharePoint, We can put any URLs in the Links list. Unfortunately, when clicking these links, the default behavior is for the page to open in the current browser window. That is, it does NOT open the page in a new instance of the browser. Often this is annoying, isn’t it?

How to open SharePoint link list item in a new window? Well, There are many ways to solve this issue:

Option 1: Site Column Approach

The Simplest solution is, enable the publishing feature, create a site column of “Hyperlink with formatting and constraints for publishing” type, add this site column to your new list. Now you will get an option to open in a new window! Here is how:

  • Step 1: Create a Site column of type “Hyperlink with formatting and constraints for publishing” (Site Actions >> Site settings >> Site columns >> Create)
  • Step 2: Add this site column to your new list (List Settings >>Add from existing). Now, You will get an option to specify whether it should open in new window.
sharepoint link list open in a new window

This can be used in SharePoint 2010 links list open link in a new window and in SharePoint 2007 also.

Option 2. You can use SPD to convert the link list to XSLT Data view and get into the code, find the tag <A href> and add an attribute target=”_blank”.

Option 3. You can edit the Schema file for the link list items to open in a new window. Here is how:

  • Open the schema file for the links list feature.  usually, is located at: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\LinksList\Links\schema.xml

In this file there should be two instances of the following:
 < Column Name =”URL” HTMLEncode =”TRUE” />< HTML ><! [CDATA[” > ]] ></ HTML >
Replace them both with this:
< Column Name =”URL” HTMLEncode =”TRUE” />< HTML ><! [CDATA[” target=”_blank” > ]] ></ HTML >

  • Then do the IISReset, and now all the links in your links lists will open a new browser window!

Option 4.  You can use jQuery to modify all links attribute, so that all links in SharePoint site, will open in new window.

<script src="" type="text/javascript">
$('a[href$="/"]').attr("target", "_blank");

Option 5. You can Make Selected Links in a Links List Open in a New Window with Little JavaScript and content editor web part. Here is how:

open links in new window
  • when creating links in the Links List, add #openinnewwindow on the end of each link that you would like to open in a new window.
  • Add the content editor webpart, and place the following code in it:
<script language="JavaScript">

function PrepareLinks()
  //create an array to store all the anchor elements in the page 
   var anchors = document.getElementsByTagName("a");
  //loop through the array
  for (var x=0; x<anchors.length; x++) 
      //does this anchor element contain #openinnewwindow?
       if (anchors[x].outerHTML.indexOf('#openinnewwindow')>0)
           //store the HTML for this anchor element
           oldText = anchors[x].outerHTML;
           //rewrite the URL to remove our test text and add a target instead
           newText = oldText.replace(/#openinnewwindow/,'" target="_blank');
           //write the HTML back to the browser
           anchors[x].outerHTML = newText;

If you want all of your external links to open in the new window you can make use of the below code:

var thisDomain = window.location.hostname;
var theLinks = document.links;
 for (i=0; i < theLinks.length; i++)
    var thisLink = theLinks(i);
   if (thisLink.href.indexOf(thisDomain) == -1 && thisLink.href.indexOf("javascript") == -1)
     { = "_blank";

Or You can use the jQuery Equivalent to make SharePoint 2010 link list open in a new window:

<script src=""></script>

$(function() {
     $('a').filter(function() {
          return this.hostname && this.hostname !== location.hostname;

Similarly, To open SharePoint Top Navigation Links in a New window, Refer: SharePoint Top Navigation Link: Open in New Window

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

20 thoughts on “SharePoint Link list: Open in a New Window

  • November 17, 2017 at 4:21 AM

    I need the other way round. I need my SharePoint to Not open in new tab/window. How to do that? Its in SharePoint 2013.

  • March 13, 2017 at 3:15 PM

    As a new SP user, the information was clear and worked great! Thank you so much.

  • December 1, 2015 at 8:25 PM

    Only works on the first page ie. on the page that shows the first 30 items

  • September 10, 2015 at 1:54 PM

    Really Great post and works great in SharePoint 2013

  • August 6, 2015 at 7:34 AM

    Hello, thanks a lot for article. I used code for “openinnewwindow” in SP2013, it works but when I use Item limit with “Display items in batches of the specified size”, so it works only at first view:( Other solutions to open every all links in new window don´t work:( What can I do?

  • May 6, 2015 at 9:58 AM

    Thank you so much! It’s really great solution!!!

  • March 24, 2015 at 2:47 PM

    Thanks for the preparelinks function. Is there a way to style the window, i.e. ‘toolbar=no,location=no,directories=no, status=no,menubar=no,scrollbars=no,resizable=yes,locationbar=no, titlebar=no, width=400,height=200,left=200,top=50’);

  • October 16, 2014 at 6:16 PM

    Thank you!!! Not only have you provided a simple and direct answer, but, your site looks like one to review regularly… please keep posting regularly 😉

  • September 10, 2014 at 4:44 AM

    It Works….. Thanks for this great solution!!!

  • January 23, 2014 at 10:18 AM

    Thank you so much 🙂

  • August 26, 2013 at 12:16 PM

    Thanks! Great post!
    I chose solution 5 for all external links and recommend adding the jQuery lib to a document library and referencing to it.

  • August 21, 2013 at 7:05 PM

    Thanks for this. I used solution 5. Works great for my purposes – at least until I change the view of my list to groupings. My links no longer open in a new window until I remove the group view. How can I fix this?

  • March 11, 2013 at 6:40 PM

    This is a way better solution than any of the others I have been searching. Thank you very much!

  • February 28, 2013 at 3:26 PM

    Great no code solution in option 1. Thank you!!

  • February 22, 2013 at 2:29 PM

    Excellent solutions! Thanks so much for sharing them.

  • February 18, 2013 at 7:30 PM

    Thanks! This was very helpful.

  • October 3, 2012 at 10:43 PM

    Running 2012 – not working for me- anything I should check? I checked the code and it still opens in the same window for me.

  • July 18, 2012 at 4:37 PM

    Been looking at loads of long winded work arounds for this solution but this worked first time without any issues!! Thank You!!!

  • June 26, 2012 at 3:27 PM

    THank you so much,,,

  • February 9, 2012 at 5:33 PM

    Great help! Thank you. I’ve added your blog to my RSS feeder for more. -Arnie


Leave a Reply