triggers when the dom is ready for the current page. Please note that the page may (or may not) still be loading. Additionally, this event may fire multiple times if the page redirects.
new for Chrome
backend. (not available on WebKit
).
triggered when the page.load event occurs
Please note that the domReady event may or may not have fired yet. Additionally, this event may fire multiple times if the page redirects.
triggers when we determine the IPageRequest has been completed. If your page is being rendered, this occurs immediately before then.
IMPORTANT NOTE: Generally you do NOT want to load external scripts (url based) here, as it will hold up rendering. Consider putting your external scripts in domReady
new for Chrome
backend. (not available on WebKit
).
will execute scripts when your IPageRequest navigation is started.
IMPORTANT NOTE: For advanced use only. This is triggered before your page starts loading, so work done by your script may not be applied properly. Consider using domReady
instead.
Additionally, this event may fire multiple times if the page redirects.
the new Automation API instead. Easier to use and more powerful.
Execute your own custom JavaScript inside the page being loaded. INPUT You can pass in either the url to a script to load, or the text of the script itself. Example:
scripts:{domReady:["//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.js","return 'Hello, World!';"]}
OUTPUT Your scripts can return data to you in thepageResponse.scriptOutput
object. You can access this directly viawindows._pjscMeta.scriptOutput
or your script can simply return a value and it will be set as thescriptOutput
(not available on external, url loaded scripts) Also, if you use the IPageRequest.renderType="script" setting, your response will be thescriptOutput
itself (in JSON format) which allows you to construct your own custom API. A very powerful feature! *IMPORTANT. The
window._pjscMeta
feature will be improved soon.: theChrome
usage of this feature will improved somewhat in the near future to be more robust. Existing functionality will stay, but added features are being considered. If you would like to provide feedback, or be notified directly when These changes occur, please contact Support@PhantomJsCloud.com. Webkit implementation will stay as-is.