Hi,

We recently had a requirement to show no of listitems on a particular list on every page within the site. So we decided to use the JavaScript that does so in our custom master page itself.

This is how we got it working

Adding the SharePoint script link that refers to the SP.js file in our custom html master page.

<!–MS:<SharePoint:ScriptLink ID=”ScriptLink21″ Name=”sp.js” runat=”server” OnDemand=”false” LoadAfterUI=”true” Localizable=”false”>–>
<!–ME:</SharePoint:ScriptLink>–>

And then executing our script using the following method i.e. after SP.js is loaded

function GetCount() {

// code that uses CSOM to get the count

}


ExecuteOrDelayUntilScriptLoaded(GetCount, "sp.js");

Hope it helps.