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 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Is there a simple way to block a website from ever loading without downloading special addons like Blocksite, just type in the website name and it can not load?

  • 12 个回答
  • 1 人有此问题
  • 1 次查看
  • 最后回复者为 Max7777

more options

I have a couple of websites that keep popping up from time to time unexpectedly. There must be a way to simply add websites names e.g. www.ihatetheseguys.net to someplace on my Firefox browser, something like a BANNED LIST. And once added that website can never open on my browser again.

This seems like it should be a very simple to thing to do.... it would be like the exceptions list we can access in options where we add websites to a list and they are allowed to open, but this would be the opposite.

I have searched around and it seems there are some add-ons/apps/programs I can download and run on my computer, one called BLOCKSITE. But I dont want to download anything. This seems like it should be a very simple to thing to do on the option page. Simply add a BANNED LIST where we can type in websites and when they try to nope they get noped away to oblivion.

I have a couple of websites that keep popping up from time to time unexpectedly. There must be a way to simply add websites names e.g. www.ihatetheseguys.net to someplace on my Firefox browser, something like a BANNED LIST. And once added that website can never open on my browser again. This seems like it should be a very simple to thing to do.... it would be like the exceptions list we can access in options where we add websites to a list and they are allowed to open, but this would be the opposite. I have searched around and it seems there are some add-ons/apps/programs I can download and run on my computer, one called BLOCKSITE. But I dont want to download anything. This seems like it should be a very simple to thing to do on the option page. Simply add a BANNED LIST where we can type in websites and when they try to nope they get noped away to oblivion.

被采纳的解决方案

To make the policy file you have to open the folder that Firefox is installed in. To do that, the easiest thing to do is just click the Firefox shortcut that is likely located on your desktop and select Open file location.

If you don't have the Firefox shortcut on your desktop, it's usually installed in either of these two locations on your computer:

  • C:\Program Files\Mozilla Firefox
  • C:\Program Files (x86)\Mozilla Firefox

Once you are there, create a new folder called distribution. Keep that folder open.

Open Microsoft Notepad. Type the code that I posted above. Then save the file to your desktop. Make the file name policies.json and change the Save as type option to All files.

Once you've done that, copy the policies.json file from your desktop to the distribution folder that you created previously. Restart Firefox and that website should now be blocked.

Hope this helps.

定位到答案原位置 👍 2

所有回复 (12)

more options

Using an extension is the easiest way, but you can block websites using either Windows Group Policy or a policies.json file.

You would need to use the WebsiteFilter policy. In a policies.json file, it would look something like this:

{
  "policies": {
    "WebsiteFilter": {
      "Block": ["*://*.ihatetheseguys.net/*"]
    }
  }
}

Hope this helps.

more options

Thank you Wesley for your reply and the help, but I am not smart enough to know where/how exactly I would input this command.

I can navigate through some menus/screens to find the proper places I need to change the options like true/false, if the instructions are clear about how to get to where I need to be...

But I dont know where this command would go. I clicked both links and did not see how to do it there either. But thank you very much for your time and the information. I will keep looking at this and try to figure it.

PS Is would nice if on the main Firefox options window under Privacy/Security / "Content Blocking" if there was, in addition to "Manage Exceptions", an additional option to easily/simply type in the name of websites I want to block. Create a banned website list.

Is there a way to submit ideas like to the team that constantly updates Firefox? It seems like this is a good idea and also seems like it would be easy to do.


In the mean time I will try to figure out how to add your code, and if I can, hopefully it will stop a particular pop up website from loading...

...and when it loads, the only way to close its window (BESIDES filling out its damned info boxes)(which will never happen on my computer)...

...IS USE Ctrl/Alt/Delete, open the Start Task Manager and shut it down from there. It is a PITA... I really do hate those guys.


Thank you again for your suggestion. Now if I can figure out how/where to add that code.

more options

The Customize Firefox using policies.json document will walk you through exactly where the file should be created and then the code that I wrote in my previous response is what should be included in the file.

Perhaps we should be addressing the bigger issue though. Why are you receiving this popup?

If it happens when you are visiting a specific website, you should probably steer clear from that website. Websites that serve popups are rarely trustworthy.

Or this popup could be coming from some kind of virus on your computer. You can try these free programs to scan for malware, which work with your existing antivirus software:

Further information can be found in the Troubleshoot Firefox issues caused by malware article.

more options

Go to the Mozilla Add-ons Web Page {web Link} (There’s a lot of good stuff here) and search for a good ad blocker.

This would be your first line of defense against all ads.

more options

Either I am lacking, or the article https://support.mozilla.org/en-US/kb/customizing-firefox-using-policiesjson is lacking, regarding the exact steps needed to add the json file. It is probably me.

""To implement this policy support, a policies.json file needs to be created. This file goes into a directory called distribution within the Firefox installation directory. This directory is not usually included by default, so you may need to manually create this directory."

I am not sure where/how to locate this file. I have done more looking and searching and it seems maybe I need to download a whole new Firefox that is customizable... maybe

I also tried poking around the about:config list to see if there was find it....

I looked over some youtubes and googled it, but I cant figure it out.

As far as an add-on? I would rather not, but thanks for the list od what you think are good ones.

Blocking (a couple of) websites seems like it would be a very simple thing.

It seems exactly like the currently available "Exceptions List" which creates a LIST OF WEBSITES ALLOWED which other wise break rules...

Except this is the exact opposite. This would a simple to create list which would DISALLOW WEBSITES that are other wise OK.

And thinking more about it.... I would like to several websites to my BANNED LIST, so I never again accidentally stumble upon stupid websites like facebook, pinterest, quora,etc etc... and I would love to ban any website that feels obligated to fill 1/2-3/4ths the screen with their crap, headers, bottoms, sidebars, infinite popup screens etc.

It would be nice to INSTA-BAN them one time and never again accidentally open them.

The more I think about this the more it is my opinion this should be a standard/normal feature of Firefox without downloading anything. I dont have to download anything to have an "exceptions list".

Anyway, I do appreciate the advice and I usually stay out of bad neighborhoods... but sometimes still find myself there.

I will keep working at this trying figuring out how to copy/paste the json code somewhere...

Some times I need cave man instructions for baking a cake... which start with more basic steps than what is on the box. e.g. go in the house (that big square thing)(open the door to go in) , find the room with a stove (read manual on operating stove), open cabinet and get a bowl and pan... then follow the basic instructions on the box. With the basic steps and only a box of brownie mix a cave man would be lost :)

I do not know how to find the "Firefox distribution directory" and the page does not show where.

I am not sure how to open it when I do find it.

I am probably OK on copy/paste the json file in to...and then probably save it... and then reboot Firefox.

I am pretty sure once I figure it out it will take 2 minutes to complete, once I have the monkey see - Monkey do things are simple :)

I will keep working on it. Thank you for your helps.

more options

选择的解决方案

To make the policy file you have to open the folder that Firefox is installed in. To do that, the easiest thing to do is just click the Firefox shortcut that is likely located on your desktop and select Open file location.

If you don't have the Firefox shortcut on your desktop, it's usually installed in either of these two locations on your computer:

  • C:\Program Files\Mozilla Firefox
  • C:\Program Files (x86)\Mozilla Firefox

Once you are there, create a new folder called distribution. Keep that folder open.

Open Microsoft Notepad. Type the code that I posted above. Then save the file to your desktop. Make the file name policies.json and change the Save as type option to All files.

Once you've done that, copy the policies.json file from your desktop to the distribution folder that you created previously. Restart Firefox and that website should now be blocked.

Hope this helps.

more options

YES!!! THANK YOU Wesley Branton!!! You are a Master among mortals! I really appreciated your patience and answering helping 3 times.

Your recent answer guided me to kitchen, showed me where the pans were and I baked perfect brownies! aka

I did it just like you said and ... then I wondered if it worked, because I can't force the evil site to open. SO.... how to test it?

(Here are some ideas for anyone who may come along later, I am sure experts wont need this, but maybe it can help someone... and I am happy to add anything which might help others.

SO... I created a folder called jason files on my desktop, and then created a couple of folders inside of that... and then I created another json file (using Wesley's EXCELLENT DETAILED INSTRUCTIONS :) which banned facebook.com aka I typed facebook.com in place of the evildoers.com .

Then I placed that in its special folder. The reason for special folder for each json file is they all have the same name, and once created I cant open them to tell them apart... but I can delete the existing json in the Firefox Directory... and then place the "TEST json.file" in its place.

Exit. Close Firefox.... then restart Firefox and try to go to facebook... and BAM!!! ACCESS DENIED!! It actually said something like "YOUR ORG HAS BANNED THIS WEBSITE!

PERFECTO!

So then I removed the facebook json.file and put the correct json.file back in, the one I need to block the evildoer website and I am sure it will block it!

Now I wonder.... can I add more blocked sites to the same file? I thought about just transferring more json.files into the directory, but they are all called named the same... so that wont work.

But maybe it is as easy as ...uhm.... adding a string of names? maybe divided by commas or something?

{

 "policies": {
   "WebsiteFilter": {
     "Block": ["*://*.ihatethoseguys.com/*", *://*.facebook.com/*" , "*://*.pinterest.com/*"]
   }
 }

}

I guess I should have tried this before I started typing, but I didn't think of it until I was half way through... and I have to close all this down to see if it works....

So I go try that.. and if it works I will post again... and if it doesn't I will post again... so either way... brb :)

more options

!!!!!VICTORY!!!!! IT WORKED!!!! THE COMMAS WORKED PERFECT!!!!

Once the policies.json file is placed in the created directory folder, THE FOLLOWING COMES UP ON THE SCREEN....


Blocked Page

Your organization has blocked access to this page or website.


ALL WEBSITES ADDED TO THE CODE LIST ARE BLOCKED

Simply use commas to separate them!

I was just guessing commas might work.... AND THEY DID!!!

BOOM!!! I AM SO HAPPY!!! YES! THANK YOU SO MUCH WESLEY!!!

{

 "policies": {
   "WebsiteFilter": {
     "Block": ["*://*.pinterest.com/*","*://*.facebook.com/*","*://*.IHATETHESEGUYS.net/*"]
   }
 }

}

Be sure to save that text in as type- all files called- policies.json and if you create more, place each new one in a separate folder labeled what it blocks. That way you can create and switch out blocked lists if you ever want to visit a block website.

I am not sure how many websites can be added to that ^ comma divided list, but I do know 3 websites THAT WILL NEVER come up on my screen again, EVER!!

This forum worked perfectly. I am delighted! Thank you Wesley!

more options

Glad I could help :)

more options

Satisfaction is so satisfying!

I just have to say after having this blocking set up for a few days it is so SATISFYING to see the BLOCKED message come up. It is working perfectly! THANK YOU AGAIN FOR THE HELP!

PS And as other scumbag websites replace the blocked one (and I know they will) I will simply add to their names to the banned line inside the code... aka... throw another BANNED LOG ON THE FIRE!!! and then they can not come in either!

For each new scumbag website I 1)create a new json.file, 2) delete the old file in the Firefox Directory 3) insert the new json.file into the Firefox Directory.

As I suspected, it is very very easy to do. It takes less than 2 minutes to create/remove/replace. Viola a new list of banned sites.

So far I have made a new file AND FOLDER for each added banned website.

I have one main folder which contains EVERY sub-folder which contains both the text file showing the guts/code... and also the json file after it is converted. That pair stays in each sub-folder (I name them after the banned websites. And all of the sub folders are held in the main folder.

I may delete some if it all becomes too unruly

I keep both both the text and json.file in each folder because once the json file is created it wont let me look inside (there might be a way to look, but I dont care to spend time figuring it out) to see the details. But the text file is there... to be added to or if I want to visit a site I simply remove the name.

I Hope that does not sound too complicated, it is actually really easy. Heck, I didn't even mean to talk this much about it....

I mainly wanted to say again how SATISFYING AND AWESOME it is to see a very safe boring BLOCKED MESSAGE appear instead of those evil, lifesucking, screen locking, infecting, scumbag websites come up.

I always (kind of knew) Firefox was cool because of it custom-ability and open access to find and alter things... and (I kind of knew about) being able to inject policies into the how it all works... and I love it! I REALLY DO! It is so nice to be able to keep these uninvited guests out of my world.

more options

Glad to hear that the solution is working well for you!

If you are planning to edit the JSON file frequently, it would probably be beneficial to give yourself the ability to read/edit the file directly, without having to copy and paste from your desktop all of the time.

To do this, follow these steps:

  1. Go to the Firefox installation folder were your JSON file is saved to.
  2. Right click on it and select Properties from the dropdown menu.
  3. Select the Security tab on the top of that popup window.
  4. Click the Edit button.
  5. This window will allow you to give the ability to read and edit the file. Click the Users group.
  6. Check the Allow checkbox for the Full Access option. All of the other Allow checkboxes should automatically be selected, but if not, simply check off the rest as well (you may not be able to select Special Persmissions).
  7. Click Apply.
  8. Click Ok.
  9. Click Ok again to close the window.

Now, you should be able to open and edit the file directly. Your computer may not automatically know how to open a JSON file. If that's the case, also try these steps:

  1. Go to the Firefox installation folder were your JSON file is saved to.
  2. Right click on it and select Properties from the dropdown menu.
  3. Select the General tab on the top of that popup window (it's usually the one that you automatically start in).
  4. Next to the Opens With option, select Change.
  5. Select whatever notepad editor you are using (probably just the builtin Notepad).
  6. Click Apply.
  7. Click Ok to close the window.

Now when you open the file, it should open directly in Notepad so that you can edit it. This will probably make the process of editing/adding new websites to the block list.

As a side note, there is a limit to how many websites you can add to the block list... it's 1000, so I doubt it will impact you, but I figured I might as well at least mention it to you :)

more options

Wow! That is more GREAT advice! And will certainly make it a lot easier to edit the banned list as needed, versus my clumsy bunch of folders.

EDIT- I just followed your excellent detailed instructions, I was able to check mark all the boxes, set it all up to be editable... closed it down... opened it back up and BOOM!!!

From now on it will be simple to edit the json.file

I can simply open up the file, add another website name, close it down and Voila!


Wesley you are EXCELLENT! It is really nice to have you out there helping. Thank you very much!

由Max7777于修改