brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.91k stars 2.34k forks source link

[Desktop] Create a WordPress plugin to install Brave #10912

Open vporton opened 4 years ago

vporton commented 4 years ago

Please create a WordPress plugin that recommends to install Brave if browsed not with Brave. The plugin should be configurable to add an affiliate link.

AveryMainstone commented 3 years ago

I don't think this would work as when websites check what browser is being used Brave shows as: "Chrome 87" for example. Source: https://www.whatsmybrowser.org/

And web browser identifier shows as: "Chrome 87.0.4280.101" Source: http://www.supportdetails.net/

And the user agent shows as something like this: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.101 Safari/537.36" Source: http://www.supportdetails.net/

So not sure if this would be possible due to how brave shows itself to websites and services unless i'm missing another identifier for the browser which websites can detect then I don't think this is possible.

patricklocke commented 3 years ago

So not sure if this would be possible due to how brave shows itself to websites and services unless i'm missing another identifier for the browser which websites can detect then I don't think this is possible.

Might be more feasible to "duck-type" it rather than just use strict user agent identification. In looking around the window object, there's window.clientInformation.brave which includes the method "isBrave", which returns a boolean as a promise. I can confirm it's returning true on random pages within the Brave browser. Idk if it's redundant, since window.clientInformation.brave is undefined in other browsers, but at first glance it appears to be a solution to the userAgent issue from above.

I'm rubbish with WP, so I dont think I'm the right person to create this plugin, but it should be possible to do so (assuming the Brave dev team continues supporting the isBrave() method, ofc)