Controlling Page Rendering
Rendering options
The parameter render_options
includes several configuration options that allow users to fine-tune how Nimble renders webpages. These options include:
Parameter | Required | Description |
---|---|---|
include_iframes | No (default = false) | Boolean - Instructs Nimble APIs to render or not to render iframes. |
timeout | No (default = 30000) Maximum: 60000 | Integer (ms) - Defines how long Nimble APIs will wait for a page to finish loading. |
render_type | No (default = load) | Enum - Defines the state that Nimble APIs will consider a page as fully loaded. |
blocked_domains | No (default = null) | Prevent loading of resources from certain domains. |
Render Type and controlling what is a "fully loaded" page
Because many webpages load additional content after the initial page has finished loading (such as single-page applications), deciding exactly when a webpage has finished loading is often ambiguous. To aid with this, Nimble APIs supports several options:
In the below example, render_type
and timeout
are combined to illustrate how to simulatenously use rendering options:
Controlling resource loading within a webpage
Webpages typically load resources from many external domains, including iframes, images, javascript files, and other resources. In some cases, it may be beneficial to restrict non-essential resources in order to speed up the loading of a page, save bandwidth, and more.
Nimble provides two rendering options that help control what parts of a page are loaded, called include_iframes
and blocked_domains
.
In the below example, we set include_iframes
to "true" to allow iframes to be loaded, and add "example2.com" and "example3.com" toblocked_domains
to prevent resources from those domains being loaded:
Last updated