> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/web/get-started/faq/slow-loading.md).

# Slow loading

World's #1 PDF SDK Library for Web, Mobile, Server, Desktop

If your application allows it you should [preload WebViewer](/web/best-practices/best-practices.md#preload-webviewer) so that when your users want to view a document, WebViewer's JavaScript, HTML and CSS will already be loaded.

It's important that your server supports HTTP range requests properly so that WebViewer can load documents incrementally instead of having to download the entire file up front.

If you're serving your files statically from your server usually range requests will just work, however if you have your own endpoint for the file there are libraries that can handle range requests for you, or you could [implement support yourself](https://tools.ietf.org/html/rfc7233#section-2.1).

## PDF WebViewer

Ideally your PDF files are linearized which means that the contents of the file are arranged efficiently so that WebViewer can download the contents for specific pages.

You can linearize files using a PDF library like PDFNet on your server. Once files are linearized you'll also need to make sure that your server supports range requests.

## Refused to get unsafe header "Content-Range"

If you are making a request to a document that is on a different origin than your web app then you may see this error even when the document loads successfully. WebViewer attempts to read the Content-Range response header as part of determining if the document is linearized, so failure to read it means that it won't be able to enable optimizations for linearized files.

You can expose this header to cross origin requests by including the [Access-Control-Expose-Headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers/) header in your response: `Access-Control-Expose-Headers: Content-Range`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/web/get-started/faq/slow-loading.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
