<script type="text/javascript">
//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<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;
}
}
}
</script>
У меня есть этот код, который я помещал в файл seattle.master перед тем, как в быстром запуске, когда я редактирую ссылки, я ставлю #openinnewwindow после адреса веб-сайта. При «пробной ссылке» открывается правильный веб-сайт. Моя проблема, когда я сохраняю его. И нажмите на ссылку, она не открывается в новом окне. Любые идеи, почему это может происходить?