Sensors blocked widget on my website that doesn't use sensors/heatmaps

Hi

Brave notifies my visitors that my website uses sensors and disables them :

image

But my website does not use sensors/heatmaps.

How can I get rid of this ?

Thank you in advance for your help

I think this piece of code in the HTML of your front page might the one using the sensor API (and triggering the indicator in the URL bar):

<script>
        var illus = document.getElementById('illustration_img');
        var logo  = document.getElementsByClassName('logo-move');
        if (window.DeviceOrientationEvent && illus){
            window.addEventListener("deviceorientation", function (){
                processGyro(event.alpha, event.beta, event.gamma);
            }, true);
            function processGyro(alpha,beta,gamma){
                illus.style.transform   = 'translateY('+ (beta)/5 +'px) translateX('+(gamma+2)/10+'px)';
            }
        }
    </script>
2 Likes

Thank you for your insight !

Is there any way to use the device orientation API without triggering this warning ?

The API is getting the device orientation from the sensors and so the sensors permission (disabled by default in Brave) needs to be granted for it to work.

What you could do however if you want to avoid the warning is to disable the use of device orientation on Brave (it’s not going to work anyways unless users manually grant the sensors permission).

Here’s some sample code to check whether or not a browser is Brave:

Thank you very much for your help !

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.