0

I would like open pc local image from external web site by click.

Thus, i've grid that contains list of image files with their absolute path related to some share location (e.g. local pc)

    Image Name | Absolute Path                |
 ==============|==============================|
    Image1.png | c:\\Desktop\\SomeImage.PNG'  |  

I faced with issue that it doesn't work.

  1. At chrome i get 'about:blank#blocked' message at new blank tab
  2. Mozila open new blank tab, but doesn't rendering image. (Note if click 'F5' the image reloading correctly)

Hosted code:

private navigateToUrl(url: string): void {
            const link = this.windowRefService.nativeWindow.document.getElementById('navigator');
            link.setAttribute('href', 'c:\\Desktop\\SomeImage.PNG');
            link.click();
        }

I try the same approache with simple index.html at local machine and that works fine

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<a target="_blank" rel="noopener" href="c:\\Desktop\\SomeImage.PNG">Manual</a>
<a id="navigator" target="_blank" rel="noopener" onclick="openImageAtNewTab()" >Javascript</a>
</body>
<script>
function openImageAtNewTab() {
  var link = window.document.getElementById('navigator');
  link.setAttribute('href', "c:\\Desktop\\SomeImage.PNG);
  lick.click();
}
</script
</html>

Q: Is it possible open image at local computer from localhost (diffrent domen)??

AllmanTool
  • 1,384
  • 1
  • 16
  • 26
  • 2
    It is a security issue and file access is blocked by the browser by default. If you can disable web security and enable file access through flag arguments to the browser, you might be able to force it, though it is not a practical solution. – Dhananjai Pai Oct 31 '19 at 13:10
  • Take a look here https://stackoverflow.com/questions/10209227/open-local-image-in-canvas – Must.Tek Oct 31 '19 at 13:14

0 Answers0