在 Firefox 中检测连接重置

发布于 2025-01-03 17:34:05 字数 203 浏览 1 评论 0原文

有没有办法检测火狐浏览器中的“加载页面问题”?我希望能够知道页面加载失败并自动重新加载页面。我还希望在浏览器尝试重新加载页面之前有一个定时的加载时间。我认为这可以通过为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

九八野马 2025-01-10 17:34:05

您可以使用进度侦听器。当页面加载完成时,将调用进度侦听器的 onStateChange 方法,并设置 STATE_STOPSTATE_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 with STATE_STOP and STATE_IS_WINDOW flags set. You can check aStatus parameter then. For example, for a "connection reset" error it will have the value Components.results.NS_ERROR_NET_RESET.

See also:
Network error codes

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文