# 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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
