Greasemonkey script on Firefox network error page

北战南征 提交于 2020-12-12 07:02:19

问题


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

alt text

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


回答1:


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

  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*.

But since we know the URL format, we can

// @include *

and check:

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

Thanks for the hints, Brock.



来源:https://stackoverflow.com/questions/3772777/greasemonkey-script-on-firefox-network-error-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!