0

I am trying to implement a Chrome Browser Extension. The Extension should take the web content (HTML + Javascript Code) of any user-requested Website and should firstly block that content from displaying. Also, no Javascript Code should be executed at this point.

The Extension should then send the entire web content to my Python Flask Web Application and wait for a response. Based on the Response of my Web Application, the Web Content should either be allowed and normally displayed and executed or be disallowed while loading a premade disallow.html file.

I know how to implement the Python Web Application, and no further discussion of the logic inside that application is needed for answering this question. The part which I'm not sure about yet is blocking content and allowing or disallowing it based on the decision of my application.

Any help would be highly appreciated

Valeed Anjum
  • 447
  • 1
  • 5
  • 17
marcels93
  • 55
  • 9
  • There should be existing questions like this. In short there's no elegant solution in Chrome except for writing a proxy in python and use it in Chrome. The inelegant solution is to use chrome.webRequest API and [nativeMessaging](https://developer.chrome.com/extensions/nativeMessaging) but it's really a huge topic which you will need to investigate yourself. – wOxxOm Jun 01 '20 at 04:27
  • @wOxxOm do you by chance know if there is an easier way of achieving this on another browser like firefox? Chrome seems to really not want you to mess with http responses – marcels93 Jun 01 '20 at 10:24
  • Firefox allows webRequest listeners to return a Promise so implementation should be straightforward. – wOxxOm Jun 01 '20 at 10:33
  • Would you be so kind to further explain how that code solution would look like in firefox? – marcels93 Jun 01 '20 at 10:44

0 Answers0