Questo sito potrebbe offrire funzionalità limitate durante le operazioni di manutenzione per migliorare l'esperienza utente. Se un articolo non risolve il tuo problema e vuoi richiedere supporto, la nostra comunità di supporto è pronta ad aiutarti tramite @FirefoxSupport su Twitter e /r/firefox su Reddit.

Cerca nel supporto

Attenzione alle mail truffa. Mozilla non chiederà mai di chiamare o mandare messaggi a un numero di telefono o di inviare dati personali. Segnalare qualsiasi attività sospetta utilizzando l'opzione “Segnala abuso”.

Ulteriori informazioni

Questa discussione è archiviata. Inserire una nuova richiesta se occorre aiuto.

How do I execute a client redirect (based on page content) to a html file?

  • 14 risposte
  • 1 ha questo problema
  • 1 visualizzazione
  • Ultima risposta di nostromov

more options

I am trying to help someone who has a Firefox Add-on that prevents access to adult sites. It works fine and when a blocked URL is entered, this is returned:

The http://www.blocked-site.com domain is blocked to protect this computer from malware or pornographic content.

[NOTE the "www.blocked-site.com" above is just an example; in actuality, the domain is shown]

My friend has created a html file on his computer with a stronger admonition and would like for the browser to redirect to, and display, his custom html file instead of what is currently served.

I am pretty sure something would have to examine the incoming page for some text excluding the actual domain because that would change depending on which site access was attempted. Maybe examine the incoming page for "domain is blocked to protect this computer" and, if present, display the html file. I just don't know how to do it.

I would appreciate any help.

I am trying to help someone who has a Firefox Add-on that prevents access to adult sites. It works fine and when a blocked URL is entered, this is returned: The http://www.blocked-site.com domain is blocked to protect this computer from malware or pornographic content. [NOTE the "www.blocked-site.com" above is just an example; in actuality, the domain is shown] My friend has created a html file on his computer with a stronger admonition and would like for the browser to redirect to, and display, his custom html file instead of what is currently served. I am pretty sure something would have to examine the incoming page for some text excluding the actual domain because that would change depending on which site access was attempted. Maybe examine the incoming page for "domain is blocked to protect this computer" and, if present, display the html file. I just don't know how to do it. I would appreciate any help.

Soluzione scelta

Thank you very much - it performs exactly as I wanted (in principle). I will have fun tweaking it.

Thanks for introducing me to the monkey user scripts. I installed TamperMonkey and it works fine.

Leggere questa risposta nel contesto 👍 0

Tutte le risposte (14)

more options

This might be a hard request to fulfill because web content, and even extensions, are not supposed to have access to file:/// URLs on your computer. It might be easier if the message page were on the internet; I think there probably are extensions to redirect from one web address to another. Then it would just be a matter of finding a good place to host the page (maybe a OneDrive folder, Google Drive, Dropbox, etc.?).

more options

I guess I did not describe it clearly. The message displayed IS on a web page. The URL is

http://haydentech.com/private/dns/dns.php?report=www.blocked-site.com

The message shown in the original post is displayed on the page for which I just provided the URL. I really messed up the question, I'm afraid.

Thanks for your response, though, it helped me clarify the issue.

more options

I know that within Firefox we can open a file:/// URL and that is precisely what we want when such a message as above is shown. I hope that makes sense.

more options

dasadler said

I know that within Firefox we can open a file:/// URL and that is precisely what we want when such a message as above is shown.

Yes, a human user can direct Firefox to do that, but websites and add-ons are not trusted to go to random parts of the hard drive...

It sounds as though the URL is very consistent and you could use an add-on to modify the page contents directly. For example, a "user script" applied using an extension like Tampermonkey, Violentmonkey or Greasemonkey could change the text from

The www.blocked-site.com domain is blocked to protect this computer from malware or pornographic content.

to something like

Just saved you from ruining your career at www.blocked-site.com. You're welcome.

The script also could modify the colors, font sizes, inject images, etc.

If that's of interest.

more options

But a script could not open a file:/// stored on the user's computer?

I thought scripts could basically act as a proxy for the user as defined by the code.

more options

jscher2000 said

It sounds as though the URL is very consistent and you could use an add-on to modify the page contents directly. For example, a "user script" applied using an extension like Tampermonkey, Violentmonkey or Greasemonkey could change the text from The www.blocked-site.com domain is blocked to protect this computer from malware or pornographic content. to something like Just saved you from ruining your career at www.blocked-site.com. You're welcome. The script also could modify the colors, font sizes, inject images, etc.

If I understand your reply... you're saying that a script could effectively create a web page dynamically? If that is the case, then I suppose it could create the same as the html file he wants displayed. Maybe even better because it could incorporate the name of the blocked site.

But where or how would someone (a very non technical someone) even begin to develop such code?

Modificato da dasadler il

more options

dasadler said

a Firefox Add-on that prevents access

Ugh., wouldn't you be better off with system-wide parental permissions?.. A (local) proxy, VPN and /or a (router) firewall made for this and similar? :-o

Modificato da nostromov il

more options

That would involve some subscription fee. Thanks anyway, I appreciate your thoughts.

more options

dasadler said

kgb said
Ugh., wouldn't you be better off with system-wide parental permissions?

That would involve some subscription fee.

I think some are free: http://www1.k9webprotection.com/

dasadler said

If I understand your reply... you're saying that a script could effectively create a web page dynamically? If that is the case, then I suppose it could create the same as the html file he wants displayed. Maybe even better because it could incorporate the name of the blocked site. But where or how would someone (a very non technical someone) even begin to develop such code?

This sounds like a call for volunteers. ;-)

I can create a template for the script. The tedious part is filling in the desired HTML because it needs to be properly quoted in order to inserted by the script.

more options

Thank you.

I think that given a template, I might (??) be able to do the HTML. The html page that has already been created is fairly simplistic. Basically changing the background color to red, an image centered at top, and a couple of lines of white text with different point size.

I would need some guidance on how/where to actually use this script. I don't know if it would go in the userChrome.css or if I would need to use one of the monkey add-ons (and how to actually use it).

more options

jscher2000 said

I can create a template for the script. The tedious part is filling in the desired HTML because it needs to be properly quoted in order to inserted by the script.

Did I miss it or was the template for the script not done? If there will not be a template created, please advise so I can seek a solution elsewhere.

Thanks.

more options

I don't know what happened to my draft script from last month, but I created a new one and posted it here:

https://greasyfork.org/en/scripts/367925-customize-hayden-technologies-dns-block-page

You would apply that using Violentmonkey / Tampermonkey / Greasemonkey. I only tested in Violentmonkey. Screenshot of the current HTML/CSS/image attached.

more options

Soluzione scelta

Thank you very much - it performs exactly as I wanted (in principle). I will have fun tweaking it.

Thanks for introducing me to the monkey user scripts. I installed TamperMonkey and it works fine.

more options

jscher2000 said

I think some are free: http://www1.k9webprotection.com/

Yes, ofc. There would have to be free services... For example, something like,

@https://www.google.com/search?q=free+adult+parental+windows+localhost+vpn

Then, there's the OpenDNS Family Shield, https://www.opendns.com/home-internet-security/

... And so on,

@https://www.google.com/search?q=free+parental+controls+dns+proxy