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. mshtml image download redirection

mshtml image download redirection

Scheduled Pinned Locked Moved COM
c++tutorialhtmlcomadobe
6 Posts 4 Posters 0 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.
  • P Offline
    P Offline
    psangeljg
    wrote on last edited by
    #1

    Hello ! I have some experience with com/webbrowser/mshtml. Recently I run into a very interesting problem, and after spending some days on it(no success) I decided to try geting some answers from other programmers. So: I wrote a simple browser helper object. On a machine without internet access, when detecting BeforeNavigate2 event, I redirect navigation. For example, if the user enters http://www.google.com, i redirect to http://mygateway/page.aspx?url="http://www.google.com". This works fine, the problem is I can't redirect the location of the objects in the document (objects; images; flash; etc), and the page can not load them. I couldn't find an event that fires when a resource download begins, and a mechanism for redirecting these downloads. (please note that implementing a download manager dows not solve this problem; dm objects are invoked only when the user explicitly selects "download targer..." from the context menu for example). Please let me know if you have any ideas ( is it possible ? is it not ? a source for more info -> i've already read all I could find in msdn and microsoft on this topic and got no answer ). I don't need specific code / code samples, I only need a hint on how to do it. I'm not interested in parsing the html code and modifying the links. pages may contain flash/applets, and i can't parse them to change the links. I need browser redirection. As soon as I'll solve this problem, I'll post the project (no mfc; no atl; just pure C++/Com). All the best, psangeljg ps. I did find a solution, but it's not what I want. I figured that mshtml uses wininet (wininet.dll) to access the resources. I could write my own wininet.dll that calls the actual wininet.dll, changing the urls. However, I try to avoid this soultion, since wininet.dll varies with the os version. Performance is also important.

    S I 2 Replies Last reply
    0
    • P psangeljg

      Hello ! I have some experience with com/webbrowser/mshtml. Recently I run into a very interesting problem, and after spending some days on it(no success) I decided to try geting some answers from other programmers. So: I wrote a simple browser helper object. On a machine without internet access, when detecting BeforeNavigate2 event, I redirect navigation. For example, if the user enters http://www.google.com, i redirect to http://mygateway/page.aspx?url="http://www.google.com". This works fine, the problem is I can't redirect the location of the objects in the document (objects; images; flash; etc), and the page can not load them. I couldn't find an event that fires when a resource download begins, and a mechanism for redirecting these downloads. (please note that implementing a download manager dows not solve this problem; dm objects are invoked only when the user explicitly selects "download targer..." from the context menu for example). Please let me know if you have any ideas ( is it possible ? is it not ? a source for more info -> i've already read all I could find in msdn and microsoft on this topic and got no answer ). I don't need specific code / code samples, I only need a hint on how to do it. I'm not interested in parsing the html code and modifying the links. pages may contain flash/applets, and i can't parse them to change the links. I need browser redirection. As soon as I'll solve this problem, I'll post the project (no mfc; no atl; just pure C++/Com). All the best, psangeljg ps. I did find a solution, but it's not what I want. I figured that mshtml uses wininet (wininet.dll) to access the resources. I could write my own wininet.dll that calls the actual wininet.dll, changing the urls. However, I try to avoid this soultion, since wininet.dll varies with the os version. Performance is also important.

      S Offline
      S Offline
      Stefan Pedersen
      wrote on last edited by
      #2

      The problem is most likely due to relative urls. You need to rewrite all urls in the orignal document to absolute urls.

      S 1 Reply Last reply
      0
      • S Stefan Pedersen

        The problem is most likely due to relative urls. You need to rewrite all urls in the orignal document to absolute urls.

        S Offline
        S Offline
        SysLo
        wrote on last edited by
        #3

        Yep, just like Stefan said. You can obtain a pointer to the HTML document you have loaded after you get the documentComplete event. Trough that pointer you can get and set for example the sources of the images or objects found on the page.

        P 1 Reply Last reply
        0
        • P psangeljg

          Hello ! I have some experience with com/webbrowser/mshtml. Recently I run into a very interesting problem, and after spending some days on it(no success) I decided to try geting some answers from other programmers. So: I wrote a simple browser helper object. On a machine without internet access, when detecting BeforeNavigate2 event, I redirect navigation. For example, if the user enters http://www.google.com, i redirect to http://mygateway/page.aspx?url="http://www.google.com". This works fine, the problem is I can't redirect the location of the objects in the document (objects; images; flash; etc), and the page can not load them. I couldn't find an event that fires when a resource download begins, and a mechanism for redirecting these downloads. (please note that implementing a download manager dows not solve this problem; dm objects are invoked only when the user explicitly selects "download targer..." from the context menu for example). Please let me know if you have any ideas ( is it possible ? is it not ? a source for more info -> i've already read all I could find in msdn and microsoft on this topic and got no answer ). I don't need specific code / code samples, I only need a hint on how to do it. I'm not interested in parsing the html code and modifying the links. pages may contain flash/applets, and i can't parse them to change the links. I need browser redirection. As soon as I'll solve this problem, I'll post the project (no mfc; no atl; just pure C++/Com). All the best, psangeljg ps. I did find a solution, but it's not what I want. I figured that mshtml uses wininet (wininet.dll) to access the resources. I could write my own wininet.dll that calls the actual wininet.dll, changing the urls. However, I try to avoid this soultion, since wininet.dll varies with the os version. Performance is also important.

          I Offline
          I Offline
          igor1960
          wrote on last edited by
          #4

          Maybe there is way to do that by setting proxy server?. "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me

          P 1 Reply Last reply
          0
          • S SysLo

            Yep, just like Stefan said. You can obtain a pointer to the HTML document you have loaded after you get the documentComplete event. Trough that pointer you can get and set for example the sources of the images or objects found on the page.

            P Offline
            P Offline
            psangeljg
            wrote on last edited by
            #5

            that's similar to parsing; you can't manage activex controls, links embedded in flash objects and the like; this works only for good old fashioned html, and that's not the case here; I need a tool that can handle any web page; the solution I implemented after one week of searching for alternates was using proxy server. That's also what igor1960 proposed, and it seems to me it's the only answer. Writing a proxy server is not a very complicated task, so it is an acceptable solution.

            1 Reply Last reply
            0
            • I igor1960

              Maybe there is way to do that by setting proxy server?. "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me

              P Offline
              P Offline
              psangeljg
              wrote on last edited by
              #6

              yes, this is the way I handled the problem in the end. Thanks for your post !

              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