0

I trying get the link a file from my serve to use in component.ts Angular

pdf_link_serve = "\\\\my_serve\\data\\pdf\\01.pdf";

But i'm getting error not allowed load file

Not allowed to load local resource: file://...

Am i getting the file link wrong or actually not able to load the file from my server ?

  • 1
    Welcome to SO. Your question is tagged angular, but there is no angular code in your question. What exactly are you trying to do? Are you trying display a link to the file in one of your components? How are you trying to display the link in your component? Are you trying to load it using ajax? Is the web site hosted on the same server? – Jason Goemaat Nov 09 '21 at 02:47
  • hi @JasonGoemaat , yes the web hosted on the same server . I trying get the link a pdf file to embed it in html – dev.for.live Nov 09 '21 at 04:05
  • How are you serving your angular app? Browsers won't give access to users' local file system for security reasons. If it is a static file you want to make part of your app, you can put in in your `src/assets` folder. If it's a file that changes and you want to show the new version, you need to serve the file from your web server. – Jason Goemaat Nov 09 '21 at 04:18
  • "you need to serve the file from your web server" How will i do it ? thanks – dev.for.live Nov 09 '21 at 04:23
  • @JasonGoemaat or how can i change the pdf name by enter the value in frame ? When i enter value is 01 => When i enter value is 02 => – dev.for.live Nov 09 '21 at 04:39
  • You should be able to get to the file that way, just drop a link on your page to the file to make sure you have access. Using an iframe is out of scope for this question I think, but there are other considerations. Check out [this question](https://stackoverflow.com/questions/38037760/how-to-set-iframe-src-without-causing-unsafe-value-exception) – Jason Goemaat Nov 09 '21 at 05:32

0 Answers0