Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Create 2000-01-01-on-resource-timeout.md #11994

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions _posts/api/webpage/handler/2000-01-01-on-resource-timeout.md
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,31 @@
---
layout: post
title: onResourceTimeout
categories: api webpage webpage-handler
permalink: api/webpage/handler/on-resource-timeout.html
---

**Introduced:** PhantomJS 1.2

This callback is invoked when a resource requested by the page timeout according to `settings.resourceTimeout`. The only argument to the callback is the `request` metadata object.

The `request` metadata object contains these properties:

* `id`: the number of the requested resource
* `method`: http method
* `url`: the URL of the requested resource
* `time`: Date object containing the date of the request
* `headers`: list of http headers
* `errorCode`: the error code of the error
* `errorString`: text message of the error

## Examples

```javascript
var webPage = require('webpage');
var page = webPage.create();

page.onResourceTimeout = function(request) {
console.log('Response (#' + request.id + '): ' + JSON.stringify(request));
};
```