title: Open new window from quick launch in Sharepoint Online
body: <pre><code>&lt;script type="text/javascript"&gt;
  
    //add an entry to the _spBodyOnLoadFunctionNames array
    //so that our function will run on the pageLoad event
    _spBodyOnLoadFunctionNames.push("rewriteLinks");
  
    function rewriteLinks() {
      //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&lt;anchors.length; x++) {
        //does this anchor element contain #openinnewwindow?
        if (anchors[x].outerHTML.indexOf('#openinnewwindow')&gt;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;
        }
      }
    }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>I have this code I put in the seattle.master file before  Then in quick launch when I edit links I put #openinnewwindow after the website address. On "try link" this opens the website right. My problem is when I save it. And click the link it does not open in a new window. Any ideas why this might be happening? </p>