please find below the code where I am trying to access a Webresource. I am working on CRM 2016
var xyz= window.xyz|| {};
$("#WebResource").contentWindow.xyz.Scheduler.load();
Gives out "Unable to get property 'contentWindow' of undefined or null reference" message.
Need help.
Don't manipulate the DOM, it's unsupported.
Do this
Xrm.Page.getControl("WebResource").getObject().contentWindow.[etc. etc.]
As already pointed out; manipulating the DOM directly is unsupported. However, if you're doing this purely for debugging purposes from the F12 console you can prepend your calls to the Xrm object as follows:
var webResource = frames[0].Xrm.Page.getControl("WebResource_Name");
var content = webResource.getObject().contentWindow.document;
Note that the specific frame containing the form does move around sometimes depending on which form you're looking at so if frames[0] doesn't work, try frames[1] instead.