How to remove Safe Search option?

Hello there. I wonder if there is a way to disable safe search option permanently? I basically want to turn it on and never see it again. I know that it’s possible to remove incognito mode option via registry editing, so I was thinking, maybe something similar can be done with safe search?

@Hellvard Hi and welcome to the community.

Try adding search.brave.com to sites that can always use cookies under customized behaviors in brave://settings/cookies and see if that works to save your safe search settings. It works for me on win10. However, if you clear cookies for all time in clear browsing data, this setting will also be cleared. You could set a different frequency to clear browsing data that will eventually allow this setting to be retained though. A little cumbersome but it works.

Hope this helps and please post an update! Take care. :slightly_smiling_face:

image

@Emi I do not think I am fully following the information you posted. I will try to identify what has me confused. Please clarify if possible. By possible, I mean if you can do without going in depth too much or I will be lost again. Even a yes/no and a name like “devtools” answer would be sufficient! :slightly_smiling_face:

  1. Are you saying my post shouldn’t work even though it appears to be working for me?
  2. So, adding scriptlet is not the same as adding a custom filter? Where would this be added now for savvy users? Where would this be done in the future, if “Brave allows you to add your own scriptlets in the UI.”, same place?

Thanks!

  1. Your post would only work in normal window and if you set cookies to be removed on restart.
    I am talking a solution that would work any computer, any or all profiles (brave adblocker works per installation so a custom filter will affect all users which is good or bad). and automatically give you the ‘off’ option right away, without you having to set it every time especially in InPrivate mode.

  2. in Brave and uBlock a scriptlet is injected by using custom filters, that’s what all the rules with ##+js() are doing, you are calling the snippet with a filter rule.
    In something like Tampermonkey, the approach is you write you script, and then you have to tell tampermonkey what places to run the script. It’s usually easier and better and Tampermonkey will let you load your own libraries like jQuery, so it becomes easier to do stuff.

I mean, in Devtools you can set cookies, yes, but it is not done automatically. to set cookies all you need to do is type in console (devtools)

document.cookie = "safesearch=off"; that’s all, that’s how simple it is.

The long answer:

So, all you need is a scriptlet injection that will do that, because that’s what a snippet or scriptlet injection do, inject JS so you can create a script that will set cookies.

uBo Scriptlets only has set local item and session item, I asked him about set cookie but he said he had no use for it.

But then I saw Brave team adding one for Brave adblocker, which is taken from Adguard and converted a way uBlock/Brave would be able to use.

But it is pretty limited, it only allows pre-defined terms like yes, no or numbers from 0 to 15 I think. Because it is meant only to get rid of cookie noticies.

uBlock never added a scriptlet to set cookies (only remove) because of security reasons.

technically in uBlock all you need to have is a file that will contain.

/// brave-search-safesearch-off.js
/// alias bsso.js
document.cookie = "safesearch=off";

In fact, Brave uses the same format, https://github.com/brave/adblock-resources/blob/master/resources/brave-fix.js because the automatic Brave will get the name and alias from those lines with ///
Then in uBlock you need to just add search.brave.com##+js(brave-search-safesearch-off) or (bsso) done.

in Tampermonkey, you don’t need the /// but you have to set some settings in the file like what domain it is going to run and all that, so the extensions knows when to run that scriptlet or not.

Brave opened an issue to do that, I guess it will be done like you do custom filters, and you add it like with the /// like in uBlock and then you can use the scriptlet as a custom filter.
But we have to wait for that to happen.

Anyway, that’s the easy script you can write to set cookies, but it will only set safesearch=off cookies, what an advanced scriptlet injection would do is let you type in what you want to be set in the cookie from custom filters.
Like if you want to set safesearch to off, strict or yes, you need an advanced scriptlet, or set any cookie to any value, like in Youtube I use ##+js(set-cookie, PREF, gl=US) like in the way you can do ##+js(acis, adblock, yes) or ##+js(nostif, ads)

In that case the scriptlet has to be more advanced to grab those terms.

Brave already has the script, but it is pretty restricted, it is mean to be used only by Brave lists and all, they don’t want anyone to touch it, but you can grab it and modify it and make it better and work in uBlock.

All anyone needs to do is to remove from line 24 (const getLimitedCookieValue = value => {) to like 44 (}) and done. you will not get restricted in the terms used by Brave.

and change line 60 to const cookieStr = createCookieStr(cookieName, cookieValue, cookiePath) done.
then you can remove line 59 with const limitedCookieValue = getLimitedCookieValue(cookieValue) since it is useless now for the change in line 60.

in my scriptlet I actually added more features, like I can set multiple cookies with the same value at the same time, like if you need to set two cookies with the value yes, I can do that.
And I also added a domain option, because sometimes the cookies are set in example.com and sometimes in www.example.com so that way I won’t have the same two cookies but in different domains, I mean, it works without the domain, but I did it because I could.

But it is easy as that, of course, until Brave doesn’t add the option to add your own scriptlet injections, then probably using tampermonkey is the best way since it will allow you to easily set cookies and be able to set where it does it (so it doesn’t do it everywhere).
But a text file loaded in the advanced uBlock settings and then call it with a custom filter there is good too, and use other scriplets like uBo ones with it, so you get more features.

Another thing to take into account is Manifestv3, I don’t know how manifestv3 is going to affect uBlock and Tampermonkey in the way the inject script or the way they allow users to do it. but I won’t really research since you know me, I actually use Brave adblocker to inject scriptlets, so I am not affected by either, it can be done but not recommended, so it’s better if people just wait for the official support Brave wants to add.

Maybe this year!

1 Like

@Emi Thank-you! Much clearer now. I think most users just want, as you say,

…a solution that would work any computer, any or all profiles… and automatically give you the ‘off’ option right away, without you having to set it every time especially in InPrivate mode.

For non-technical users, just setting an option already available without having to reset it each time would be great. Allowing more technical savvy users options for customizations would be a perk too. It seems like a simple fix to the non-technical user, but from your post, the background issues that must be considered are much deeper than just toggling a switch on/off.

Thanks again. Take care. :slightly_smiling_face:

@Emi Dang Emi, that looks like a lot of work! From your explanation, I can see how this would be awesome for someone who understands the process.

I just couldn’t use this as I don’t have the background or understanding to fix or maintain this type file. Ditto for any changes to custom scripts that would need to be made in the future.

Why can’t Brave do this? I could then just use the custom filters you provided. Yep, that would work for me! lol

Take care. :slightly_smiling_face:

Gee, thanks. :rofl:

Oh, cool, neat little trick.

Ugh. That boggles my mind!

Thanks for the expanded and additional information. I will just have to wait. The fear factor is just too great for me to try anything outside the box!

I really do enjoy reading your posts even if I miss or don’t understand the finer points. :face_with_spiral_eyes:

Thank-you! Take care. :slightly_smiling_face:

I was hoping for some simple solution, not walls of text and code :smiley: Thanks for all answers nonetheless. Too bad I don’t understand much of it :stuck_out_tongue: