Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 Jaxer.Sandbox.open(url,null,openOptions); 获取 url 内容的方法。我想找出获取 url 内容所需的时间。如果这个过程需要很长时间,比如超过 6 秒。然后应该显示自定义错误页面。
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.