• Public
  • Public/Protected
  • All

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 the pageResponse.scriptOutput object. You can access this directly via windows._pjscMeta.scriptOutput or your script can simply return a value and it will be set as the scriptOutput (not available on external, url loaded scripts) Also, if you use the IPageRequest.renderType="script" setting, your response will be the scriptOutput itself (in JSON format) which allows you to construct your own custom API. A very powerful feature! *


  • IScripts




domReady: string[]

triggers when the dom is ready for the current page. Please note that the page may still be loading.


load: string[]

new for Chrome backend. (not available on WebKit). triggered when the page.load event occurs


loadFinished: string[]

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


pageNavigated: string[]

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.