Referenzieren auf eine JQuery Datei im 15 hive und der MasterPage

SharePoint 2013 nutzt sogenannte virtuelle Pfade um auf Dateien zu verweisen. Wir haben uns dafür entschieden die JQuery Datei im 15 hive abzulegen und anschließend über die Master Page darauf zu verweisen. Dafür rufen wir auf dem SharePoint Server den physikalischen Speicherort auf: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\ dort legen wir dann einen Ordner an mit dem Namen scripts und legen dort die JQuery Datei ab.

In der Master Page verweisen wir dann im Head Bereich auf unseren virtuellen Pfad.

Theorie:     /_layouts/15/<your folder>/<your files>

Praxis:         <SharePoint:ScriptLink language=”javascript” ID=”ScriptLink1″ Name=”~Site/_layouts/15/scripts/jquery-1.9.1.js” runat=”server” />

Um zu testen ob JQuery nun verfügbar ist können wir folgenden Code verwenden und über ein Webpart auf einer beliebigen SharePoint Seite einfügen:

$( document ).ready(function() {

// Your code here

});

Weitere Informationen:
http://www.ashokraja.me/post/Refer-Scripts-and-CSS-Style-Sheet-in-SharePoint-2013-Visual-Web-Part-and-Master-Page.aspx

The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.

About Dennis de Vries 34 Articles
Loving SharePoint, Social Media and like to work together with creative people all over the world.

Be the first to comment

Leave a Reply

Your email address will not be published.


*