0

How can I intercept downloading of media on a web page (as opposed to something like a user clicking on a "download" button for example)? For example, for if I want to show the Google home page but with a different background image.

Is there an event for that? (I couldn't find one.) Or some other way?

ispiro
  • 26,556
  • 38
  • 136
  • 291

3 Answers3

1

Injecting JavaScript as per ispiro's suggestion would work, and works in the way your phrasing suggests.

If you're simply replacing one URL with another though, you could download the HTML source as text or XML, replace the URL string, and then use the modified HTML as the source in your WebBrowser control. This instead provides a modified webpage which simply requests different resources.

It won't work if the page loads the image via javascript in such a way that obsfucates the image URL however.

Octopoid
  • 3,507
  • 5
  • 22
  • 43
0

Your best bet here is probably to inject javascript into the page (See here). There isn't an event that touches content really.

Community
  • 1
  • 1
Skyl3lazer
  • 368
  • 2
  • 10
0

I think you can use a HttpWebRequest to get the HTML edit it and feed it to a web browser control.I think this is one way of doing it.

confusedMind
  • 2,573
  • 7
  • 33
  • 74