0

I implemented an API to get Image with Content-Type →image/png. Some thing like abc.com/photo-back/getimage/?url=hello.jpg But this API, I check client key from the header to authentication.

so when I use with IMG tag, it cannot load image because cannot pass the header checking.

So are there any way to show image with img tag in this case?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Bui Anh Tuan
  • 910
  • 6
  • 12

1 Answers1

0

Have a look at this answer. Fetching the images through XMLHttpRequest seems to be the only possible solution if you want to set request headers.

Community
  • 1
  • 1
philipproplesch
  • 2,127
  • 17
  • 20
  • Thanks for your solution but I think the window.btoa(unescape(encodeURIComponent( str ))); is depend on browser. So it very hard when we want to run in devices – Bui Anh Tuan Apr 02 '14 at 09:01