3 ms·
Not links. Requests. PhantomJS is a scriptable browser, as a second of googling will tell you.
by rsanders 11y ago
Not links. Requests. PhantomJS is a scriptable browser, as a second of googling will tell you.
- tlibert 11y agoyes! from the api docs: onResourceRequested Introduced: PhantomJS 1.2 This callback is invoked when the page requests a resource. The first argument to the callback is the requestData metadata object. The second argument is the networkRequest object itself. The requestData 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 The networkRequest object contains these functions: abort() : aborts the current network request. Aborting the current network request will invoke onResourceError callback. changeUrl(newUrl) : changes the current URL of the network request. By calling networkRequest.changeUrl(newUrl), we can change the request url to the new url. This is an excellent and only way to provide alternative implementation of a remote resource. (see Example-2) setHeader(key, value)