I have some client-side javascript in a model-driven app that should show/hide controls based on whether a particular file in the associated record's SharePoint document location exists.
My thought was to send an HEAD request with XMLHttpRequest; if I receive a 200 OK response, then I should be able to assume the file exists. If I open the path of the file in my browser, it opens successfully. However, when I call it from my script, the response is 403 Forbidden - presumably because the request does not carry appropriate authentication.
Am I missing some easier/better way of accomplishing my objective? I can't see any method in the Xrm Web Api that would allow me to do it.