Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

본 사이트는 여러분의 사용자 경험을 개선하기 위해 유지 보수를 진행하는 동안 기능이 제한됩니다. 도움말로 문제가 해결되지 않고 질문을 하고 싶다면 Twitter의 @FirefoxSupport 및 Reddit의 /r/firefox 채널을 활용하세요.

Mozilla 도움말 검색

고객 지원 사기를 피하세요. 저희는 여러분께 절대로 전화를 걸거나 문자를 보내거나 개인 정보를 공유하도록 요청하지 않습니다. "악용 사례 신고"옵션을 사용하여 의심스러운 활동을 신고해 주세요.

자세히 살펴보기

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

  • 14 답장
  • 1 이 문제를 만남
  • 1 보기
  • 최종 답변자: 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.

선택된 해결법

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.

문맥에 따라 이 답변을 읽어주세요 👍 0

모든 댓글 (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?

글쓴이 dasadler 수정일시

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

글쓴이 nostromov 수정일시

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

선택된 해결법

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