Sharepoint - How can I use the SharePoint Javascript Object Model from a plain HTML page?

The SharePoint JavaScript client object model only works on pages that are a part of the SharePoint framework (i.e. in Web Parts, Application Pages, etc.). This tutorial makes mention of that: http://www.codeproject.com/Articles/60348/SharePoint-2010-Client-Object-Model-for-JavaScript.aspx


This is what I used to fix this problem:

<SharePoint:ScriptLink Name="MicrosoftAjax.js" runat="server" Defer="False" Localizable="false"/>
<SharePoint:ScriptLink Name="SP.core.js" runat="server" Defer="False" Localizable="false"/>
<SharePoint:ScriptLink Name="SP.js" runat="server" Defer="True" Localizable="false"/>

I added the above ScriptLinks in this order, and defered both the MicrosoftAjax.js and SP.Core.js includes, and delayed the SP.js. The SP.js file has dependencies in the preceding includes that requires it to be delayed.

Tags:

Javascript