0

I was wondering if it is somehow possible to intercept all JavaScript API calls of a website using a browser extension.
The background is that I would like to log what APIs some websites use and even block access to certain APIs or simply provide fake data instead of real data.
I know you can intercept HTTP requests etc, but I would really like to just find out when an API is actually accessed.

So for instance, I would like to find out when webRTC or webGL are being used, when a canvas is being read/manipulated or even when a website checks the mouse cursor position.

I couldn't really find anything on google about this. Did I miss anything? Or are you aware that something like this will be implemented in the future? I would really like to know.

Forivin
  • 14,780
  • 27
  • 106
  • 199

1 Answers1

0

https://webrtchacks.com/webrtc-notify/ describes a chrome extension which shims and detects usage of the WebRTC APIs. Its not perfect as there are ways to prevent the content script from being run.

Firefox has better APIs for intercepting WebRTC described in https://hacks.mozilla.org/2015/09/controlling-webrtc-peerconnections-with-an-extension/

Philipp Hancke
  • 15,855
  • 2
  • 23
  • 31