Formulation of the problem

When opening sites in the browser, you need to pre-process the content and, changing the content of the page, show it in the browser. That is, everything happens at the client, and not on the server.

Example

Find a specific text on the page and select it with a frame or indicate with an arrow.

Additional terms

The code that processes the content is in the external application. Let's say C ++. That is, I would like to somehow transfer the data to the application (via the file?) And after receiving the updated page, show it to the user. Suppose that the browser FireFox, although it may well be that it does not matter. OS - Windows.

My solution

WebExtensions / upload to file / upload response / page substitution. I'm not sure yet that this is realizable and that the API is enough.

Alternative

Make some kind of proxy, where to do all this, but I do not know which one. If I had the opportunity in WinAPI to write a hook to intercept the html-text and the possibility of its replacement - this would be probably the easiest solution for me.

Question

What is the easiest way to solve this problem?

I would be grateful if you point out an example.

  • Immediately suggests: collect HTTP proxy. - D-side
  • Perhaps you just need to make an extension for the browser, this is most simply done, and it will work with both http and https - Dmitry Polyanin

1 answer 1

Browser extensions can be done in JavaScript, which provides a lot of possibilities for working with the DOM . This is exactly what you need to search and highlighting the text.

If the JavaScript hand is not full, but you need to do a lot and as soon as possible, it is better to study (don't let the car crash on my head) jQuery . This is a JavaScript library that helps to perform running tasks by typing a minimum of code.

The alternative method (I’m talking about proxy in C ++) is interesting because of its complexity, but it requires experience, perseverance, and knowledge (not only C ++, but also web protocols, parsers, regular expressions, etc.). If you wish, it’s probably better to start by exploring ready-made implementations on GitHub or similar resources as examples. There are many, you can probably even find something as a basis.