Tuesday, March 22, 2016

STSNavigate in SharePoint

In this below script,STSNavigate in SharePoint

STSNavigate in SharePoint
In this article menu item uses createNewDocumentWithRedirect function in core.js file

<asp:content contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">
       <SharePoint:RssLink runat="server"/>
      
       <Script>
       function STSNavigate(Url){
              window.open(STSPageUrlValidation(Url),"_blank");
       }
       </Script>
</asp:content>

STSNavigate in turn calls STSPageUrlvalidation: 
function STSPageUrlValidation(url)
{ULSxSy:;
    return PageUrlValidation(url);
}
It then calls PageUrlValidation - THIS IS THE KEY PART:
function PageUrlValidation(url)
{ULSxSy:;
    if ((url.substr(0, 4)=="http") ||
        (url.substr(0, 1)=="/")     ||
        (url.indexOf(":")==-1))
    {
        return url;
    }
    else
    {
        var L_InvalidPageUrl_Text="Invalid page URL: ";
        alert(L_InvalidPageUrl_Text);
        return "";
    }
}

No comments:

Post a Comment