I've got a PDF, which is filed on one of our server. I've got an url for opening this PDF in my browser like this: file://myServer/myFolder/myFile.pdf
.
Now when I copy this url and paste it in a new tab in my browser (IE and Chrome), it opens it correctly.
Now I would like to implement <a></a>
link tag and open the same url, which I put in the href
attribut.
ex. <a target="_blank" href="file://myServer/myFolder/myFile.pdf">PDF</a>
When I click on the link, it opens the PDF again correct in a new tab in both browser (IE and Chrome).
So my next step is it, to get a json object with the url for the PDF's filed on this server. And with angularJS I'd put the url dynamicly in my link tag in the html. So I do this:
let fileObj = [
{
filename: 'File 1',
url: 'file://myServer/folder1/myFile1.pdf'
},
{
filename: 'File 2',
url: 'file://myServer/folder2/myFile2.pdf'
},
{
filename: 'Website XY',
url: 'http://www.myWebsite.com'
}
];
And than with angularJS I build a link tag in my html with the dynamic href url:
<a ng-repeat="file in fileObj" target="_blank" href="{{file.url}}">{{file.filename}}</a>
So when I look at this in my console, it has the correct url in the href
and also the correct text within the a-tag etc. like in my first example above, when I wrote the url hardcoded in the href
. But when I now click on the link, nothing happens on Chrome on IE it works fine! EDIT: The third link, which opens a website works on both browser... What's wrong? For me it seems to be the same like the hardcoded one, but the first one works, the second one doesn't. It's also confusing, that it works fine on IE and on Chrome not! I got follow msg in the console on chrome: Not allowed to load local resource
It seems to be a browser problem...Any ideas?
Thanks.