'Find out sandbox.open(url,null.....) execution time

I am using Jaxer.Sandbox.open(url,null,openOptions); method to fetch url contents. I want to find out time required to fetch url content. If this process took long time say more than 6 seconds, then custom error page should display.



Solution 1:[1]

If I read your question right,

var sandbox = new Jaxer.Sandbox(url,null,options);
if(sandbox.waitForCompletion(5000))
  {
    // Page loaded
    return {contents:sandbox.toHTML()};
  }
  else
  {
    // Took too long
    return {error:"Request Timed Out"};
  }

That should do the trick.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Na7coldwater