Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. COM
  4. WebBrowser Control - intercept requests [modified]

WebBrowser Control - intercept requests [modified]

Scheduled Pinned Locked Moved COM
javascripthtmlcssgraphicsdesign
2 Posts 1 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sdc395
    wrote on last edited by
    #1

    Hi all I've searched and searched but I can't find a method that will enable me to intercept requests from a WebBrowser control and then provide my own, programmatically generated responses. Currently, my application uses the control to provide 90% of the UI by loading HTML, CSS and Javascript from disc using the "file" protocol. The scripts then call my app's dispatch interface to make things happen. What I would like to be able to do is effectively serve these files without coding my own HTTP server. I'm hoping there's a point at which I can intercept the WebBrowser's request and then write my own response back to it. This response will usual consist of the contents of a file extracted from an archive or from the app's resources. I would also like to be able to spot requests for images (by parsing the URL) so that I can render SVG graphics to a file as a PNG (or similar) and stream that file back to the browser. So, is there some interface I can implement and supply to the browser in order to achieve the above? As I said, I'd like to avoid writing my own HTTP server or Asynchronous Pluggable Protocol handler. Thanks in advance Simon

    modified on Friday, January 30, 2009 10:56 AM (typo)

    S 1 Reply Last reply
    0
    • S sdc395

      Hi all I've searched and searched but I can't find a method that will enable me to intercept requests from a WebBrowser control and then provide my own, programmatically generated responses. Currently, my application uses the control to provide 90% of the UI by loading HTML, CSS and Javascript from disc using the "file" protocol. The scripts then call my app's dispatch interface to make things happen. What I would like to be able to do is effectively serve these files without coding my own HTTP server. I'm hoping there's a point at which I can intercept the WebBrowser's request and then write my own response back to it. This response will usual consist of the contents of a file extracted from an archive or from the app's resources. I would also like to be able to spot requests for images (by parsing the URL) so that I can render SVG graphics to a file as a PNG (or similar) and stream that file back to the browser. So, is there some interface I can implement and supply to the browser in order to achieve the above? As I said, I'd like to avoid writing my own HTTP server or Asynchronous Pluggable Protocol handler. Thanks in advance Simon

      modified on Friday, January 30, 2009 10:56 AM (typo)

      S Offline
      S Offline
      sdc395
      wrote on last edited by
      #2

      Well, in case anyone stumbles across this post, I thought I'd let you know how I solved my problem (well, this one anyway)... Turns out a pluggable protocol is the solution. The basics are easy to write and, critically, they can be registered on a per-process basis. I invented my own URL scheme, implemented an APP for it, registered my APP class factory using CoInternetGetSession and IInternetSession::RegisterNameSpace and away I went. The UI is now "served" via my own URL scheme by my own APP on a per-process basis.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups