chrome packaged app image access

后端 未结 1 1858
清酒与你
清酒与你 2021-01-16 06:47

I am having trouble accessing images in the chrome packaged app. These images are stored locally. Code works fine in the browser.

following image tag



        
相关标签:
1条回答
  • 2021-01-16 07:16

    See:

    https://developer.chrome.com/apps/app_external#external

    What you have to do is fetch the binary contents of the image with XMLHttpRequest as a blob, then convert that blob to an object URL, and that's the URL you set as the src attribute of the img. It's easier than it sounds, and the cited web page gives you the code.

    0 讨论(0)
提交回复
热议问题