Cannot access Xrm.Page.context from within HTML web resource in CRM
<p>I'm trying access the Xrm.Page.data object from within an HTML web resource. I try to access the Xrm context, I find that it is undefined or that Xrm.Page is null. The code for the web resource is as follows: </p>

<pre><code>function GetClientUrl() {
        if (typeof window.parent.Xrm.Page.context == "object") {
            clientUrl = window.parent.Xrm.Page.context.getClientUrl();
        }
        var ServicePath = "/XRMServices/2011/Organization.svc/web";
        return clientUrl + ServicePath;
    }
</code></pre>

<p>It's just appen when it's embedded in an HTML web resource. Can anyone explain what I'm doing wrong? 
Thank you.</p>