0

I am new to Angular.js. I have created a link called as "sample-list" and My requirement is after clicking on that link browse open a excel from the given location. Please let me know the solution of it.

I have tried something like this in html. But getting error as "Not allowed to load local resource: file:///D:/temp/project/abc.xls" sample list

Thank you.

NullPointer
  • 152
  • 1
  • 16

1 Answers1

0

First of all it doesn't seem as though you're accessing your page through a web server (http). So when you use a relative file url like relative_path/abc.xls, it's trying to access a file relative to your file system which is not allowed by javascript for security reasons.

If you know where the file is going to be on your server, you can just use window.open('absolute_or_relative_url.xls', '_blank'); or something more advanced like: Download File Using Javascript/jQuery

Community
  • 1
  • 1
tommybananas
  • 5,718
  • 1
  • 28
  • 48