Add link to example of using a CORS proxy.

Rob Wu 2015-09-14 22:05:56 +02:00
parent 243598089d
commit f7904f63e6

@ -20,7 +20,7 @@ You can modify the `DEFAULT_URL` variable in the `web/viewer.js` file or you can
<a name="faq-xhr"></a>
## Can I load a PDF from another server (cross domain request)?
Not by default, but it is possible. PDF.js runs with the same permissions as any other JavaScript code, which means it cannot do cross origin requests (see [Same origin policy](http://en.wikipedia.org/wiki/Same_origin_policy) and [an example](https://gist.github.com/3452072)). There are some possible ways to get around this such as using [CORS](http://enable-cors.org/) (see also [unsafe headers issue](https://github.com/mozilla/pdf.js/issues/3150#issuecomment-17582371) and [Access-Control-Expose-Headers issue](https://github.com/mozilla/pdf.js/issues/4530)) or setting up a proxy on your server that will feed PDF.js the PDF file. Both workarounds are out of the scope of the PDF.js project and we will not provide code to do either.
Not by default, but it is possible. PDF.js runs with the same permissions as any other JavaScript code, which means it cannot do cross origin requests (see [Same origin policy](http://en.wikipedia.org/wiki/Same_origin_policy) and [an example](https://gist.github.com/3452072)). There are some possible ways to get around this such as using [CORS](http://enable-cors.org/) (see also [unsafe headers issue](https://github.com/mozilla/pdf.js/issues/3150#issuecomment-17582371) and [Access-Control-Expose-Headers issue](https://github.com/mozilla/pdf.js/issues/4530)) or setting up a proxy on your server that will feed PDF.js the PDF file (example: https://github.com/mozilla/pdf.js/issues/1000#issuecomment-133756244).
<a name="faq-support"></a>
## What browsers are supported?