Domanda

I create the project "SharePoint 2013 - empty Project", add SharePoint Layouts Mapped Folder, then add to script file, path /_Layouts/SearchWords/jquery.min.jsand publish project. I see my folder in C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS but not see in http://sp/_Layouts/ after publish project. "SharePoint Server Publishing" is activate to all sites and subsite. What is the problem, how is the fixed?

È stato utile?

Soluzione

Try using absolute path to the file like given below:

<script type="text/javascript" src="https://test.sharepoint.com/sites/siteName/_layouts/15/SearchWords/jquery.min.js"></script>

Or for short path, try using below:

<script type="text/javascript" src="/sites/siteName/_layouts/15/SearchWords/jquery.min.js"></script>

Altri suggerimenti

You can use JSLink with ~sitecollection token to get current site collection dynamically

<SharePoint:ScriptLink ID="jqueryScript" language="javascript" name="~sitecollection/_layouts/15/SearchWords/jquery.min.js" OnDemand="true" runat="server"/>

Or ~layouts token to get URL of the Layouts virtual folder for the current website

<SharePoint:ScriptLink ID="ScriptLink1" language="javascript" name="~layouts/SearchWords/jquery.min.js" OnDemand="true" runat="server"/>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top