简体   繁体   中英

change url of PDF in this pdf.js demo?

I am trying to change the url of the pdf in this pdf.js HTML5 pdf viewer, but when I do the canvas is blank instead of displaying the new pdf.

Why does it do this and how can I get it to display and pdf ?

Here it is: http://jsbin.com/pdfjs-helloworld-v2/1/edit

Thanks for answering my questions above - the problem probably lies with where the pdf file is located.

When you run it from jsbin.com - and you call in the pdf document you described in your comments, the browser console returns the following error:

XMLHttpRequest cannot load http://www.onwardsearch.com/UX-Career-Guide/UX-Career-Guide-Infographic.pdf . Origin http://jsbin.com is not allowed by Access-Control-Allow-Origin.

These two threads on stackoverflow should help you further

Why am I seeing an "origin is not allowed by Access-Control-Allow-Origin" error here?

and

XmlHttpRequest error: Origin null is not allowed by Access-Control-Allow-Origin

In the future, to look at the console frame in Chrome - Ctrl+Shift+J

Console frame in Firefox - get firebug add on - will save you a ton of time

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM