Reputation: 95
Is it possible somehow to block accesing to WebRTC API via JavaScript in Chrome?
I have a page, where I can call JavaScript code before other part of page is loaded and I need to disable WebRTC API that will be called later.
For example, maybe I can override some WebRTC classes or methods? If I want to disable document.write, I can easily do with next code
document.write = null;
Any ideas?
Upvotes: 2
Views: 1784
Reputation: 1
Maybe above solution worked in the past, but NO LONGER works in 2023. Such values are READ-ONLY and cannot be redefined by userscript.js.
Best bet to Block legacy WebRTC and therefore browser exploit of legacy WebRTC (which is FREQUENTLY used today by many websites to track users, incl. unmasking VPN users) is to use FireFox Browser and disable WebRTC by going to About:Config and setting "media.peerconnection.enable" to False.
Other browsers (notably Chrome and Safari) show very little to no interest in helping users protect their identity against the exploit, so options there are very limited (e.g., 3rd party browser extension).
To test your own status, go to https://browserleaks.com.
Upvotes: -1
Reputation: 42530
Sure:
navigator.mediaDevices.getUserMedia =
navigator.webkitGetUserMedia =
navigator.mozGetUserMedia =
navigator.getUserMedia =
webkitRTCPeerConnection =
RTCPeerConnection = undefined;
Should work in all browsers.
Upvotes: 8