In CRM we have a projects list and there are associated files with these projects on our network drive. Didn't want to setup Sharepoint due issues we have had with it in the past.
Anyway, in each of these project records we want to add the network URI for that project's files so the user can click on the link from the CRM record and be brought to that direct. So something like X:\Projects\contoso
.
Came across this suggestion for accomplishing this:
http://blog.zealots.solar/?p=54
Basically consists of making an HTML page and inserting it as a web resource on the form, which makes it an iframe.
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<a id="doclink" style="border: 0px currentColor;" href="http://www.example.com" target="_blank">
<img style="border: 0px currentColor;" src="stsr_folders_icon.png">
</a>
<script language="javascript" type="text/javascript">
var linkval = window.parent.Xrm.Page.data.entity.attributes.get("stsr_documents").getValue();
var a = document.getElementById('doclink');
a.href = "file:"+linkval;
</script>
</body>
</html>
Of course updating the window.parent.Xrm.Page.data.entity.attributes.get("stsr_documents")
and the <img src=
. It takes the URI values from the stsr_documents
field and appends it to the image.
It does accomplish the appending and generating a correct file:///X:/Projects/contoso
. You can type this URL into the browser and it will bring up the directory.
However, just clicking it results in the following errors:
Not allowed to load local resource: file:///X:/Projects/contoso
in Chrome 73.0- No error in Edge 42 (URI is
file:X:/Projects/contoso
), but doesn't do anything at all - IE 11 same thing as Edge: same URI, no error, just nothing happens
- Firefox 66: same... no error and nothing happens; URI is
file:///X:/Projects/contoso
To be clear: I'm not asking why the error is coming up or why it isn't working. It is pretty clear from the abundance of questions regarding it that is a security feature of pretty much all modern browsers to not load local resources. That much I get.
What I'm wondering is what a work around is, if there is one. Some suggest setting up a web server, but I'm not sure how that would work given I don't have access to the CRM web server.
What other solutions might there be?