O'Reilly logo

Mastering PhoneGap Mobile Application Development by Kerri Shotts

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Downloading files from a server

It's always been possible to utilize XMLHttpRequest to send and receive content from external servers, which means that technically you could dispense with the File Transfer plugin entirely and use XHR, even for large files.

While it is possible, it's not ideal for several reasons. They are as follows:

  • You're subject to any cross-origin restrictions, which may mean adding CORS support to the target server
  • The data you receive isn't actually stored anywhere; you're still responsible for writing it out to a file
  • You'll need to write a good deal of boilerplate code unless you are using an abstraction

The File Transfer plugin, on the other hand, has the following benefits:

  • It reads and writes from the native file system without ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required