Saturday, 15 March 2014

Add javascript reference in SharePoint

Add javascript reference in SharePoint
If you have REST based url in your site, you can add your js file using below code...
<script src='<SharePoint:EncodedLiteral runat="server" text="<%$SPUrl:~SiteCollection/MyLibarary/MyProject.js%>" EncodeMethod="HtmlEncode"/>' type="text/javascript"></script>
Or try
<script src="~SiteCollection/MyLibarary/MyProject.js" type="text/javascript"></script>