2

I have a site collection on the root directory http://pc51:1001 and a site collection under the sites directory http://pc51:1001/sites/First .

I am trying to add jQuery file reference in Master Page so it will work on both site collections

What is the best practice method for adding a jQuery reference in the Master Page?

My jQuery file resides in /Style Library/ABC/Js/jquery-1.10.2.min.js

0

You can use below line in your master page to access your JS file anywhere from entire site collection.

<script type="text/javascript" src="<asp:Literal runat='server' Text='<%$SPUrl:~sitecollection/Style Library/Envera/Js/jquery-1.10.2.min.js%>' />"></script>
| improve this answer | |
  • I was looking for the same. It worked for me. Found this post at the right time. Cheers! – Aks Apr 7 '16 at 11:31
  • it worked for me... – Akshay Dattatray Nangare Apr 7 '16 at 11:32
  • 2
    This will break MDS for 2013/O365 users – John-M Apr 7 '16 at 11:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.