Posts

Showing posts from February, 2015

Right way to add CSS and JavaScript to SharePoint App Pages and Master-Pages

In SharePoint-Hosted App, there is a special way to embed your JavaScript and CSS. Adding JavaScript: To add JavaScript that resides in the "layouts\15" folder, just specify the file name: < SharePoint:ScriptLink name=" sp.core.js " runat="server" LoadAfterUI="true" Localizable="false" /> To Add JavaScript that resides in your app, for example in "Scripts" folder of your SharePoint-Hosted App: <SharePoint:ScriptLink name=" ~site/Scripts/App.js " runat="server" OnDemand="false" LoadAfterUI="true" Localizable="false"></SharePoint:ScriptLink> Adding CSS: To add CSS to a SharePoint-Hosted App, you need to know how SharePoint works, its a bit different form that way JavaScript is embedded in the app. Initially I thought, I could use "<SharePoint:CssLink" just the way I used "<SharePoint:ScriptLink", but it wasn't true. Sha