> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# renderJavaScript

> Whether to render web pages with a headless browser and crawl the rendered HTML.

* **Type**: `boolean | string[] | object`
* **Default**: `false`

Rendering JavaScript-based web pages is slower than crawling regular HTML pages.
That's why you can apply this setting to a list URLs that match patterns (using [`micromatch`](https://github.com/micromatch/micromatch)).

The headless browser has a default timeout of 20 seconds.
You can adjust it with the `renderJavaScript.waitTime` parameter.

<Note>
  Enabling this feature can lead to inconsistent records across crawls,
  depending on the browser load and the website speed.
</Note>

Make sure your JavaScript-enabled pages load fast enough for the crawler.

## Examples

```js JavaScript icon=code theme={"system"}
{
  renderJavaScript: true,
}
```

```js JavaScript icon=code theme={"system"}
{
  renderJavaScript: [
    "http://www.mysite.com/dynamic-pages/**",
  ],
}
```

```js JavaScript icon=code theme={"system"}
{
  renderJavaScript: {
    enabled: true,
    waitTime: {
      min: 7000,
      max: 15000,
    },
    adblock: true,
    patterns: [
      "http://www.mysite.com/dynamic-pages/**",
    ],
  }
}
```

## Parameters

<ParamField body="adblock" type="boolean" default="false">
  Whether to activate the custom ad blocker.
  It blocks most ads and tracking scripts but may break some websites.
</ParamField>

<ParamField body="enabled" type="boolean">
  Whether to render pages with a headless browser and crawl the rendered HTML.
</ParamField>

<ParamField body="patterns" type="string[]">
  URL patterns to determine which pages to render with a headless browser.
  If not specified, and `enabled` is true, **all** pages are rendered.
</ParamField>

<ParamField body="waitTime" type="object">
  The shortest and longest wait time before considering a page as rendered.

  <Expandable>
    <ParamField body="min" type="number" default={0}>
      If the page runs faster than this,
      the browser remains open at least this long (in milliseconds).
    </ParamField>

    <ParamField body="waitTime.max" type="number" default={20000}>
      Number of milliseconds to wait before stopping the rendering
      and processing the HTML as is.
    </ParamField>
  </Expandable>
</ParamField>
