Wednesday

SharePoint Selected Links in a Links List Open in a New Window

If you want selected link in a links list or summary link in SharePoint follow the steps.


Step 1: Copy and paste the following code in your master page above the closing head tag and also replace the square bracket with anchor bracket.
                                                [script language="JavaScript"]
_spBodyOnLoadFunctionNames.push("rewriteLinks");

function rewriteLinks() {
     var anchors = document.getElementsByTagName("a");
     for (var x=0; x
          if (anchors[x].outerHTML.indexOf('#newwindow')>0)
{
               
oldText = anchors[x].outerHTML;
              
newText = oldText.replace(/#newwindow/,'" target="_blank');

               anchors[x].outerHTML = newText;

          } } }
[script]

                                               
Step 2: If you want selected link to open in a new window just type #newwindow after the url as shown  below.