In this tutorial, we will discuss how to enable sp.js in Publishing Pages in SharePoint 2013. By default, sp.js is not visible in publishing pages. As the SharePoint uses minimal download strategy it prevents the page to have sp.js when published but the point to note is when you open your ribbon bar (edit or unpublished state) sp.js script gets loaded in your page.
Note: SharePoint loads scripts on Demand
So to solve this we can do like this:
1. Add a script editor web part in your page and in script tags just add the following code snippet:
SP.SOD.executeFunc(‘sp.js’, ‘SP.ClientContext’, sharePointReady);
Where sharePointReady is a method which will be executed after sp.js is loaded.
Download FREE SharePoint 2019 Installation PDF Guide
This FREE PDF contains, Steps by step guide to install SharePoint 2019 Preview, prerequisites, hardware and software new features. First impression to SharePoint Server 2019 new modern site, modern lists and modern document libraries.
You May Also like the Following SharePoint Online Tutorials: