> For the complete documentation index, see [llms.txt](https://docs.iproyal.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.iproyal.com/cn/gong-ju/wang-luo-jie-suo-qi/javascript-xuan-ran.md).

# JavaScript渲染

默认情况下，Web解锁器会尝试使用简单的HTTP请求加载网站。它会检查HTTP响应状态码，若响应成功（如状态码为200），则将响应正文返回给客户端。

然而，有些网站会在返回200 OK的状态码的同时，也会返回占位符或错误信息，提示**JavaScript已被禁用**。在这种情况下，实际页面内容未被渲染或显示。

为解决这一问题，Web解锁器提供了**按需启用的JavaScript渲染功能**（通过特殊的渲染标志来实现）。该功能会指示解锁器在无头浏览器中完整渲染页面后再返回响应，从而支持访问依赖JavaScript的内容。

**如何使用**`渲染标`**志**

您在代理凭证的密码后附加`_render-1`即可启用渲染功能。示例如下：

```
curl -x http://username:password_render-1@unblocker.iproyal.com:12323 https://example.com  -k -v
```

**应用场景**

* 访问需要JavaScript才能显示内容的网站
* 绕过依赖JavaScript的反爬虫验证页面
* 爬取具有动态前端的现代Web应用程序

**注意事项**

* 由于启动无头浏览器会产生额外开销，渲染可能会导致响应时间变长。
* 仅在需要时使用渲染功能，因为大多数网站仍然可通过基本的HTTP请求访问。


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.iproyal.com/cn/gong-ju/wang-luo-jie-suo-qi/javascript-xuan-ran.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
