Parene Parene - 1 year ago 118
Javascript Question

Chrome APP/Extension download file from URL

I've been researching and i did not found anything about that.

I need a chrome application that will run on Chrome OS be able to download a file (image, mp3, video, etc) and then display the content as HTML.

I mean if the app download a video, then play it on a video tag. The same for a it and display on img tag.


Xan Xan
Answer Source

See Chrome App documentation on Handling external content. It provides a good overview.

A short version:

  1. Declare the origins you're going to access in the manifest.
  2. Fetch the resource via XHR (or, indeed, Fetch API).
  3. Use the response as a blob: (you can plug it into a <video src="...">, for instance).
  4. Optionally, save the resource locally.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download