Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Greasemonkey script on Firefox network error page

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?

like image 696
Andrew Keeton Avatar asked Nov 16 '25 22:11

Andrew Keeton


1 Answers

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.

like image 141
Andrew Keeton Avatar answered Nov 18 '25 20:11

Andrew Keeton