admin管理员组文章数量:1323323
I'm trying to add jQuery to sharepoint 2013 master page. What I did:
1)
- Copy jquery - "jquery-1.11.1.min.js" to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\LAYOUTS.
- Copy seattle.html and add
<!--SPM:<SharePoint:ScriptLink language="javascript" name="/_layouts/jquery-1.11.1.min.js" runat="server" Localizable="false" />-->
- Upload seattle.html as ASP NET MASTERPAGE
- Publish it ---> Nothing happend. To seattle.master wasn't appear Sharepoint:Scriptlink
2)
- Copy jquery - "jquery-1.11.1.min.js" to SiteAssets. My application is on root site collection so for instance access to jquery is
http://localhost/SiteAssets/jquery-1.11.1.min.js
- Copy seattle.html
- Add
!--SPM:<SharePoint:ScriptLink language="javascript" name="'~sitecollection/SiteAssets/jquery-1.11.1.min.js" runat="server" Localizable="false" />-->
- Still no effect
- Add
What is the correct way from begining to the add of adding Jquery to Sharepoint 2013?
I'm trying to add jQuery to sharepoint 2013 master page. What I did:
1)
- Copy jquery - "jquery-1.11.1.min.js" to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\LAYOUTS.
- Copy seattle.html and add
<!--SPM:<SharePoint:ScriptLink language="javascript" name="/_layouts/jquery-1.11.1.min.js" runat="server" Localizable="false" />-->
- Upload seattle.html as ASP NET MASTERPAGE
- Publish it ---> Nothing happend. To seattle.master wasn't appear Sharepoint:Scriptlink
2)
- Copy jquery - "jquery-1.11.1.min.js" to SiteAssets. My application is on root site collection so for instance access to jquery is
http://localhost/SiteAssets/jquery-1.11.1.min.js
- Copy seattle.html
- Add
!--SPM:<SharePoint:ScriptLink language="javascript" name="'~sitecollection/SiteAssets/jquery-1.11.1.min.js" runat="server" Localizable="false" />-->
- Still no effect
- Add
What is the correct way from begining to the add of adding Jquery to Sharepoint 2013?
Share Improve this question asked Aug 14, 2014 at 9:54 AdrianXAdrianX 1631 gold badge7 silver badges17 bronze badges2 Answers
Reset to default 4Probably you forgot to apply custom master page, go to Master Page settings page and set Site Master Page
and System Master Page
to your custom master page.
Note: there is a typo in the second option: name attribute contains
'
symbol
How to reference JavaScript file in SharePoint 2013 master page
Assume the following scenario:
- a custom master page
helsinki.master
with associated HTML file are used - jQuery library
jquery.min.js
is located in SharePointSite Assets
library
Then, in order to reference jQuery library in custom master page the following steps are used:
- Open an associated HTML file
helsinki.html
- Insert the line
<!--SPM:<SharePoint:ScriptLink language="javascript" name="~sitecollection/SiteAssets/jquery.min.js" runat="server" Localizable="false"/>-->
- Publish
helsinki.html
- Go to Master Page settings page and set
Site Master Page
andSystem Master Page
tohelsinki.master
About System Master Page
System Master Page is used by administrative pages, lists, and document library views on this site
This approach has been tested in SharePoint 2013 and works for me.
i would suggest to add jQuery with a custom DelegateControl. With this approach there is no need to modify the MasterPage. Every Masterpage contains a placeholder where you are able to hook in custom scripts, like jQuery.
Here is a detailed description how to develop the solution: http://blogs.msdn./b/kaevans/archive/2011/04/06/adding-jquery-to-every-page-in-sharepoint-with-delegate-controls.aspx
The cool thing with the delegateControl is, that you can use any scopes for this Solution. So you can apply jQuery to the whole Farm, Webapplication, Sitecollection or Web.
Regards
本文标签: javascriptHow to add Jquery to MasterPage 2013Stack Overflow
版权声明:本文标题:javascript - How to add Jquery to MasterPage 2013 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742130688a2422144.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论