Firefox网络错误页面上的Greasemonkey脚本

Firefox网络错误页面上的Greasemonkey脚本

本文介绍了Firefox网络错误页面上的Greasemonkey脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Firefox网络错误页面上运行Greasemonkey脚本,例如(但不限于)以下页面:

I want to run a Greasemonkey script on Firefox network error pages, such as (but not limited to) this one:

我可以使用 chrome:// URL来做到这一点吗?如果是这样,它们是什么?如果没有,还有其他方法吗?

Can I do this with chrome:// URLs? If so, what are they? If not, is there another way?

推荐答案

好吧,我的目标是正确的.两件事:

Well, I was almost on the right track. Two things:

  1. 网络错误页面以 about:neterror 开头,而不是以 chrome://开头.如果您尝试访问 ww.example.com (缺少aw),那么您将被重定向到 about:neterror?e = dnsNotFound& u = http%3A//ww.example.com/&c=UTF-8&d=Firefox%20can%27t%20find%20the%20server%20at%20ww.example.com
  2. 您不能//@include about:neterror * .
  1. Network error pages begin with about:neterror, not chrome://. If you try to access ww.example.com (missing a w) then you will be redirected to about:neterror?e=dnsNotFound&u=http%3A//ww.example.com/&c=UTF-8&d=Firefox%20can%27t%20find%20the%20server%20at%20ww.example.com
  2. You cannot // @include about:neterror*.

但是由于我们知道URL格式,所以我们可以

But since we know the URL format, we can

// @include *

并检查:

if (document.documentURI.search('about:neterror') != -1) {
    doStuffOnNetError();
}

谢谢你的提示,布罗克.

Thanks for the hints, Brock.

这篇关于Firefox网络错误页面上的Greasemonkey脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 13:06