# loadDocument HEAD calls

**URL:** <https://pdfjs.community/t/loaddocument-head-calls/1720>\
**Category:** Technical Support\
**Tags:** pdfjs-express\
**Created:** [May 30, 2022, 5:32am UTC](https://pdfjs.community/t/loaddocument-head-calls/1720 "2022-05-30T05:32:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![fuse](https://avatars.discourse-cdn.com/v4/letter/f/8e8cbc/32.png) [@fuse](https://pdfjs.community/u/fuse)\
**Post date:** [May 30, 2022, 5:32am UTC](https://pdfjs.community/t/loaddocument-head-calls/1720/1 "2022-05-30T05:32:23Z")

</div>

Hello there,  
After upgrading to PDFJS Express 8.4.0 we noticed that our API start receiving an extra HEAD call when loading documents via documentViewer.loadDocument.

Is there an option that we can pass to the function to disable that or any other work-around?

Thank you

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/ffbcd25c7d423db8d5acd5db201c272f4db306dd.png) [@system](https://pdfjs.community/u/system)\
**Post date:** [May 30, 2022, 5:32am UTC](https://pdfjs.community/t/loaddocument-head-calls/1720/3 "2022-05-30T05:32:28Z")

</div>

**Hello, I’m Ron, an automated tech support bot 🤖**

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:
- [Events for PDF.js Express - Document loading](https://pdfjs.express/documentation/learn-more/events.8#document-loading)
- [PDF.js Express Viewer APIs](https://pdfjs.express/documentation/viewer/api)
- [Open a document, add annotations, download - 2. Listen for document load](https://pdfjs.express/documentation/use-case/upload-download.8#2.-listen-for-document-load)

APIs:
- [Core.DocumentViewer - setWatermark(options)](https://pdfjs.express/api/Core.DocumentViewer.html#setWatermark__anchor)
- [PDF.js Express Utilities](https://pdfjs.express/api/utils/index.html#__anchor)
- [Core.Document - enableColorSeparations(options)](https://pdfjs.express/api/Core.Document.html#enableColorSeparations__anchor)

Forums:
- [Pdfjs.express watermark despite licence key & correct domain](https://pdfjs.community/t/pdfjs-express-watermark-despite-licence-key-correct-domain/1592/1)
- [Error 504 trying to merge xfdf - Urgent](https://pdfjs.community/t/error-504-trying-to-merge-xfdf-urgent/1691/1)
- [Error when loading xfdf annotations](https://pdfjs.community/t/error-when-loading-xfdf-annotations/1380/1)

---

<div class="post-metadata">

**Author:** ![wli](https://avatars.discourse-cdn.com/v4/letter/w/b487fb/32.png) [@wli](https://pdfjs.community/u/wli)\
**Post date:** [May 30, 2022, 10:54pm UTC](https://pdfjs.community/t/loaddocument-head-calls/1720/4 "2022-05-30T22:54:31Z")

</div>

Hi,

Ma I know if you’re loading from an extensionless URL or not? As the HEAD request is a request we make to determine the file type based on the mime-type header if there was no extension in the URL

Thanks.

Wanbo

---

<div class="post-metadata">

**Author:** ![fuse](https://avatars.discourse-cdn.com/v4/letter/f/8e8cbc/32.png) [@fuse](https://pdfjs.community/u/fuse)\
**Post date:** [June 6, 2022, 1:24am UTC](https://pdfjs.community/t/loaddocument-head-calls/1720/5 "2022-06-06T01:24:42Z")

</div>

Hello Wanbo, thanks for replying promptly.

Yes, the url we use does not include the extension, however after making changes and adding extension to that call I still observe the error in the console. Do I need to send the request with a reserved key or some other trick?

Thank you

---

<div class="post-metadata">

**Author:** ![wli](https://avatars.discourse-cdn.com/v4/letter/w/b487fb/32.png) [@wli](https://pdfjs.community/u/wli)\
**Post date:** [June 6, 2022, 9:41am UTC](https://pdfjs.community/t/loaddocument-head-calls/1720/6 "2022-06-06T09:41:48Z")

</div>

Hi,

Could you attach your current code that how to load the document? Thanks.

Wanbo

---

<div class="post-metadata">

**Author:** ![fuse](https://avatars.discourse-cdn.com/v4/letter/f/8e8cbc/32.png) [@fuse](https://pdfjs.community/u/fuse)\
**Post date:** [June 7, 2022, 4:48am UTC](https://pdfjs.community/t/loaddocument-head-calls/1720/7 "2022-06-07T04:48:29Z")

</div>

```javascript
documentViewer.loadDocument(pdfUrl,
            {
                onLoadingProgress: percent => {
                    if(this.state.loading) this.setState({ progress: percent * 100 })
                },
                extension: "pdf"
             }
        );

```

where pdfUrl doesn’t have the filename nor extension.

When I pass document url as `https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf` works fine and loads the document without extra head call. However, `https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf` will make an extra head call and display error.

Am I failing to see an obvious difference?

Thanks

---

<div class="post-metadata">

**Author:** ![wli](https://avatars.discourse-cdn.com/v4/letter/w/b487fb/32.png) [@wli](https://pdfjs.community/u/wli)\
**Post date:** [June 7, 2022, 10:53pm UTC](https://pdfjs.community/t/loaddocument-head-calls/1720/8 "2022-06-07T22:53:11Z")

</div>

Hi,

Could you attach the error you’re seeing? Thanks.

Wanbo
