> 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/infinite-loading-loop.md).

# WebViewer is loading in an infinite loop

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

When using a single page app boilerplate such as [create-react-app](https://github.com/facebook/create-react-app/), sometimes the default settings will redirect invalid requests (404s) to the home page.

This can cause infinite loading loops when WebViewer tries to load files, because instead of finding the UI's `index.html` file , it finds the main `index.html` file of your app instead. This index file then is loaded inside WebViewer's iframe.

For example, take the following React code:

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
import React, {useEffect} from 'react';
import './App.css';

const  App = () => {

  useEffect(() => {

    window.WebViewer({
      path: '/test', // < ---------- This is invalid / 404
    }, document.getElementById('app'))

  }, [])

  return (
    <div className="App" id='app' style={{border: '1px solid black', padding: '20px'}}>
      My App!
    </div>
  );
}

export default App;
```

{% endcode %}
{% endtab %}
{% endtabs %}

In this example, `path` is invalid and points to a 404, which `create-react-app` will redirect to your apps `index.html`. The result looks like this:

![](https://3532544125-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FX9YnTSKIHvV7m0A36LbO%2Fuploads%2Fgit-blob-2caaa0c018d7cc22024273f092bf510d8edf31a2%2F497e042632388e77b9a779676ced5dcccf2dd233-1462x212.png?alt=media)

If you run into this scenario, please make sure that you are passing a valid path to the `path` constructor option, and that it points to the `lib` folder that is included with the WebViewer package.


---

# 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/infinite-loading-loop.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.
