It shouldn’t happen because that navigator.brave
is only present in Brave.
I am not JS guru, I only use it as hobby but seems like reading the code, some stuff clearly seems like it could improved.
For example, what is the purpose of ‘detecting brave twice’ and then the two messages h3? you know the ones “Brave Browser not detected” and the other with “Operate Your Wallet&Node from Brave Browser” technically one would never be used because window.navigator.brave != undefined
and window.navigator.brave.isBrave.name == "isBrave"
will always co-exist and be true when using Brave. There is no way Brave will be != undefined and then ==isBrave will be false or that’s what I have seen.
In that case wouldn’t if (window.navigator.brave != undefined && window.navigator.brave.isBrave.name == "isBrave")
be better?
That means the logic for the messages is kind of more complicated than it should be, since one of the else would never happen and one h3 message would be displayed if the person is not using Brave.
BTW, you can test Brave without the API, if you use example##+js(brave-fix)
in brave://adblock as custom rule, which will make it easy to remove the API with the simple scriptlet Brave created and then you can test it inside Brave too, how would it work without it. you can also add all your website domains like example1,example2 and that rule would apply to all of them in case you want to test them without it and not just in another browser.
Like I said, I am not coder, just learned it because I like to learn, especially when I started making my own scriptlet injections for the adblocker. But I am not like the person who would say any code or anything, just say what I think when I read the code and how Brave seems to work.
Anyway, hope something I said can be helpful! Take care.