maybe by replacing with an i-frame or something.
maybe we can do this too, when someone is typing a bad word like “porn” or “bdsm” etc the user is directed to google search or the history sent the user to host.
i know safe search, my question is clear i think for everyone, i want to add a new function to my add-on, not activate safe-search on google engine, thanks anyway !
Well everytime i was looking on google search it was like everyone was saying it’s impossible to block google images thumbnails.
everyone is also saying it’s impossible to replace those thumbnails by another picture.
my add-on blocks tons of urls and i would like to implement that feature:
when someone is trying to look for porn pictures in google image, the pictures doesn’t show & instead show another picture a car, a cat or anything else.
so thats my dream for 2018 i would like to achieve that, implement that function in my add-on, but i need help.
There is not a single question mark in your first post, ergo you didn’t ask a question at all.
Your implied question is probably “How can I do that?”.
As @freaktechnik points out, blocking or redirecting images (by URL) is not a problem.
What is a problem is to find out which URLs to block (and that, by the way, is not really an extension development question).
AFAIK, the thumbnail URLs in question are just hashes etc, so they contain zero information about the image content. A URL based filter won’t work.
Now, you could try something like if the tab that request one of these thumbnails is a Google search with blacklisted terms, block it. But I think that is a pretty bad idea. There are tons of therms to search for, in dozens of languages, Google could always change or extend its search term format, and Google searches are somewhat context sensitive (think: search for porn first (blocked), then search for something that could be porn, Google will infer the pornographic meaning from the recent search history and display porn, you don’t block it).
For that reason, don’t even bother. Whatever you come up with would never be as reliable as Googles own SafaSearch filter. If you would give me 50.000 USD for an implementation that is better than Googles, I wouldn’t waste my time attempting it.
So, I’d “force-enable” the build-in SafeSearch. That can be done and shouldn’t be to difficult either.
i found this:
In the Google Search Settings, the Filter explicit results setting enables safe search functionality. When enabled, the setting is stored in a browser cookie as FF= and passed to the server each time the user performs a Google search.
Appending safe=active to a Google search query URL also enables the strictest safe search settings.
Safe Search Enforcement for Google and YouTube Searches using a Virtual IP Address
Google provides servers that Lock SafeSearch (forcesafesearch.google.com) settings in every Google and YouTube search. By adding a DNS entry for www.google.com and www.youtube.com (and other relevant Google and YouTube country subdomains) that includes a CNAME record pointing to forcesafesearch.google.com to your DNS server configuration, you can ensure that all users on your network are using strict safe search settings every time they perform a Google or YouTube search.
According to the documentation you linked, the DNS based solution offered by Google is defensively the most elegant one, but I don’t think WebExtensions can mess with DNS (yet).
If you have (admin) access to the computers in question, you can probably do this with the hosts file. If you can manage HDCP in the network, you can set up a DNS resolver.
If you have to do this with an extension, you can enforce both URL parameters and cookies, but user/content scripts are definitely not the best place to do it. I’d probably manipulate the Cookie header and/or the URL in a webRequest.onBeforeRequest handler.
Well, DNS is not an IP-address, so you can’t “CHANGE the DNS to 185.228.168.168”, and WebExtensions can generally not change the network routers settings.
So, again, what exactly is it you want to know how to do?
i saw that on a hacker website newspaper where they where talking about how javascript can change the dns of a router, so it is feasible!
but what i want is just block image thumbnails xxx from google image search !
my add-on blocks access to urls, but not to image thumbnails in google image search !
Hackers being able to change the DNS settings of “a router” is a long way from a reliable solution.
I don’t have the feeling this dicussion is moving anywhere productive, so unless you have specific (and well defined) questions, you’ll just have to try things out yourself.
What i want is just block image thumbnails xxx from google image search !
my actual add-on block access to urls, but not to image thumbnails in google image search !
that’s the only thing i want to implement in my add-on code