# PDF not loading issue using URL

**URL:** <https://pdfjs.community/t/pdf-not-loading-issue-using-url/2139>\
**Category:** Technical Support\
**Created:** [November 2, 2022, 4:41pm UTC](https://pdfjs.community/t/pdf-not-loading-issue-using-url/2139 "2022-11-02T16:41:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anurag.kurmi](https://avatars.discourse-cdn.com/v4/letter/a/e495f1/32.png) [@anurag.kurmi](https://pdfjs.community/u/anurag.kurmi)\
**Post date:** [November 2, 2022, 4:41pm UTC](https://pdfjs.community/t/pdf-not-loading-issue-using-url/2139/1 "2022-11-02T16:41:34Z")

</div>

**Which product are you using?**  
PDF.js Express Plus

**PDF.js Express Version**  
8.7.0

**Detailed description of issue**  
When I am passing this url of my pdf file which is this [https://x9oo-fwyq-gkdq.n7.xano.io/vault/cIQOyqj4/aq1ODkTCEIHvsYY7wZn5nZNjVTo/qCt-vA../sample.pdf](https://x9oo-fwyq-gkdq.n7.xano.io/vault/cIQOyqj4/aq1ODkTCEIHvsYY7wZn5nZNjVTo/qCt-vA../sample.pdf) my viewer is not able to load that file and giving me the default page not found error from my theme. I tried both the ways of loading pdf file from URL as you can see in below code snippet.

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/a/a5afbda819c63a0a6841debd98ad4e6e3eef182f.png)

**Expected behaviour**  
The PDF provided from URL should be loaded fine because the pdf file is publicly accessible.

**Does your issue happen with every document, or just one?**  
All documents

**Link to document**

> **[sample.pdf](https://storage.googleapis.com/x9oo-fwyq-gkdq.n7.xano.io/vault/cIQOyqj4/aq1ODkTCEIHvsYY7wZn5nZNjVTo/qCt-vA../sample.pdf)**
>
> 2.96 KB

**Code snippet**  
WebViewer(  
{  
// path: ‘/webviewer/lib’,  
initialDoc: ‘[https://x9oo-fwyq-gkdq.n7.xano.io/vault/cIQOyqj4/aq1ODkTCEIHvsYY7wZn5nZNjVTo/qCt-vA../sample.pdf](https://x9oo-fwyq-gkdq.n7.xano.io/vault/cIQOyqj4/aq1ODkTCEIHvsYY7wZn5nZNjVTo/qCt-vA../sample.pdf)’,  
},  
viewer.current  
).then((instance) =\> {  
// instance.UI.loadDocument(  
// ‘[https://x9oo-fwyq-gkdq.n7.xano.io/vault/cIQOyqj4/aq1ODkTCEIHvsYY7wZn5nZNjVTo/qCt-vA../sample.pdf](https://x9oo-fwyq-gkdq.n7.xano.io/vault/cIQOyqj4/aq1ODkTCEIHvsYY7wZn5nZNjVTo/qCt-vA../sample.pdf)’,  
// { filename: ‘sample.pdf’ }  
// );  
}

---

<div class="post-metadata">

**Author:** ![kkim](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kkim](https://pdfjs.community/u/kkim)\
**Post date:** [November 2, 2022, 8:37pm UTC](https://pdfjs.community/t/pdf-not-loading-issue-using-url/2139/3 "2022-11-02T20:37:00Z")

</div>

Hi [anurag.kurmi](https://pdfjs.community/u/anurag.kurmi),

Thank you for contacting pdf.js express forums,

I noticed that downloading the file and opening as a local file will load fine. In our separate demo, [JavaScript PDF Viewer Demo](https://pdfjs.express/samples/viewing/viewing/)

I get the following error when loading this url:  
`https://x9oo-fwyq-gkdq.n7.xano.io/vault/cIQOyqj4/aq1ODkTCEIHvsYY7wZn5nZNjVTo/qCt-vA../sample.pdf`

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/0/015851224a8df8c63ee3c4d6f8e86c4bab90c17d.png)

But when I try the resolved URL:  
`https://storage.googleapis.com/x9oo-fwyq-gkdq.n7.xano.io/vault/cIQOyqj4/aq1ODkTCEIHvsYY7wZn5nZNjVTo/qCt-vA../sample.pdf`  
Then it loads as expected:

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/d/d5e774806b892bec5288c4de3138327910ee529a.jpeg)

As a side note, I also tried the 1st url in our sister product PDFTron WebViewer ([PDFTron WebViewer Demo: JavaScript PDF Viewer Demo](https://www.pdftron.com/webviewer/demo/)), and this is the error message:

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/9/9bc1b6b540572f54c9744b33cce784f1f61de5e5.jpeg)

Please use the domain ‘[storage.googleapis.com](http://storage.googleapis.com)’ because this is likely due to preventing unsafe url redirecting when loading the document.

Best Regards,  
Kevin Kim

Share how you are using PDF.js Express in your organization you could win a **$500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free**. Learn more [here](https://utm.guru/ueQNw)
