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)??

4

0 回答 0