在 Firefox 中检测连接重置
有没有办法检测火狐浏览器中的“加载页面问题”?我希望能够知道页面加载失败并自动重新加载页面。我还希望在浏览器尝试重新加载页面之前有一个定时的加载时间。我认为这可以通过为 Firefox 编写一个附加组件来完成,但在我学习如何做到这一点之前,我想知道它是否可能。我研究过的所有路径都只会引导我完成页面加载后可能发生的事情。在这种情况下,由于请求的站点流量较高,连接会中止,并且页面永远不会加载。
is there a way to detect "problem loading page" in firefox? i'd like to be able to know that the page load has failed and automatically reload the page. i'd also like to have a timed allowance for a page to load before the browser tries to reload it. i think this can be done by writing an add-on for firefox, but before i learn how to do that i want to know if it's even possible. all of the paths i have researched have only led me to things that are possible after the page has loaded. in this case the connection is aborted due to high traffic on the site requested and the page never loads.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用进度侦听器。当页面加载完成时,将调用进度侦听器的
onStateChange
方法,并设置STATE_STOP
和STATE_IS_WINDOW
标志。然后您可以检查aStatus
参数。例如,对于“连接重置”错误,其值为Components.results.NS_ERROR_NET_RESET
。参见:
网络错误代码
You can use progress listeners. When a page finishes loading the
onStateChange
method of your progress listener will be called withSTATE_STOP
andSTATE_IS_WINDOW
flags set. You can checkaStatus
parameter then. For example, for a "connection reset" error it will have the valueComponents.results.NS_ERROR_NET_RESET
.See also:
Network error codes