Block any URL and another method! , more thorough than Adblock, more flexible than hosts, no need to restart the browser
Source: Internet
Author: User
Transfer from Sociz (formerly Mozine) forum
Original Sticker Address: http://hall.sociz.com/index.php?showtopic=20662
There are several ways to block URLs, and using the Adblock extension does not completely block a domain name, modify the Hosts file to block specific URLs, or use wildcards. The following method will give an alternative shielding strategy: automatic proxy blocking.
Add a sentence here. See a lot of people seek to block embedded text ads extension or method, some people say with ad muncher can X off, which is impossible from the principle of Web page parsing, can only use hidden methods.
Use Notepad to save the following code as a "*.pac" File ("PAC" extension)
Code
function FindProxyForURL (URL, host)
{
Blacklist
if (shExpMatch (host, "114.*") | |
shExpMatch (URL, "*/ad/*"))
Return "PROXY 0.0.0.0:0";
Else
return "DIRECT";
}
Then set in Firefox: Tools =〉 options =〉 Advanced =〉 network =〉 settings =〉 automatic proxy configuration URL, fill in the "*.pac" local path, such as "File:///C:/Firefox/proxy.pac", complete.
Now enter "114.xyz.com" or "WWW.XYZ.COM/AD/ABC" in the Address bar, the following prompt will appear:
File Attachment block_with_proxy.pac.png (9.96KB) Download number of times: 28
You can add any URL you want to filter in your code, here's an example
"URL" indicates the requested URL:
"Http://adv.imhb.cn/index.php?ID=5"
"Host" indicates the domain name of the requested URL:
"Adv.imhb.cn"
Use the symbol "*" as a wildcard to match any character:
"shExpMatch (Host," *id=7* ")"
"| |" means "or" i.e. or:
"shExpMatch (Host," 114.* ") | | shExpMatch (URL, "*/ad/*") "
&& "means" and "that and:
"shExpMatch (Host," 114.* ") && shexpmatch (URL," */ad/* ")"
“!” The expression "non" is not:
"!shexpmatch (Host," 114.* ")"
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.