Is it possible to get extern links in a list opened in a new windows?
I only found tutorials for SharePoint (Designer) 2010, but I'm using SharePoint 2013 on Office 365.

  • Do you mean links which are available on AllItems.aspx page like link to an item or may be some other?
    – Asad Refai
    Jun 16, 2015 at 10:04
  • @AsadRefai: No, I mean extern links to other resources (e.g. google.com).
    – user38595
    Jun 16, 2015 at 10:07

6 Answers 6


Our solution is more simple. If it's an external link, then add a class to the anchor tag

$('a').each(function() {
      if(getHostName($(this).attr('href')) !== 'SiteURL' && getHostName($(this).attr('href')) !== 'AnotherSiteURL') {
                $(this).attr('target', '_blank');           }

Use Summary Links Web Part to open links (internal and external) in new window, without writing a single line of code.

To enable Summary Links Web Part, you will have to enable Publishing feature though.


Yes. You can. Just create a listview webpart in custom page in which you can have the links you want. And in that page you can add the javascript or jquery to find the anchor tag and add the property target='_blank'. It'll work.


Here is the JavaScript code which you can add in your page so that all external links open in new tab

Make sure to refer jquery reference

<script type="text/javascript" src="jquery"></script>
<script type="text/javascript">
 var url = '://' + window.location.hostname;

 // get the current website name, and i add :// to make sure we're looking at the right name
 // in the URL, rules out http://www.google.com/site:wss.domain.com
 url = url.toLowerCase(); // lowercase everything to compare apples to apples
 $("a").each(function() {
 var link = this; // assign the link object to another variable for easier managability
 var linkHref = link.href.toLowerCase(); // lower case it
 if(linkHref.indexOf(url) < 0 && linkHref.indexOf('javascript:') < 0){
 // check to see if this A object has this domain in it and make sure it's not a javascript call
 link.target = '_blank'; // change the target to be in the new window

 if(linkHref.indexOf('.pdf') > 0){ // check to see if this is a PDF
 link.target = '_blank'; // change the target to be in the new window
 $(link).removeAttr("onclick"); //remove the SP click event

 if(linkHref.indexOf('/forms/') > 0 && linkHref.indexOf(').aspx') > 0){
 //check for links in the forms library
 link.target = '_blank'; // change the target to be in the new window
 $(link).removeAttr("onclick"); //remove the SP click event


  • I did everything explained in this tutorial, but unfortunately I don't see an effect. The hyperlinks in my list still open in the same window, though the script I added is on the site (I can see that in she source code in the browser).
    – user38595
    Jun 17, 2015 at 11:52
  • Can you check on browser console whether any error is coming
    – Amit Kotha
    Jun 17, 2015 at 12:31

I was looking for the same thing and ended up with the following no code solution:

If you have publishing feature enabled, create a site column of "Hyperlink with formatting and constraints for publishing" type and add this Site column in your new list and you'll get the option to open in a new window.

Source with details and screenshots. Hope it helps!


These solutions stop working if the user filters the view. If I knew the event that happens after the refresh is done (the document does not reloads) I could run this again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.