-2

My task at hand is to download a file through vba. The problem is, that the page is mostly generated via JavaScript. Sorry that i cannot just share the page with you, because I dont own it, but I will try to make things as clear as possible.

The HTML from the IE source viewer looks similar to this:

<head>
  css stuff
  jscript link
  more jscript links
  more css stuff
</head>
<body>
divs and links and so on

<div magic inside that div that shows on browser but not in source code></div>

</body>

I very much believe that the java script generates an iframe and fills it with html code.

Do you think that it is possible to retrieve the finished iframe from the java script? Because I can literally see the HTML code when i use the chrome DOM explorer, but I cannot fetch the HMTL data in vba. It drives me crazy that I dont understand this :D

Thank you for your time

omegastripes
  • 12,351
  • 4
  • 45
  • 96
The Pony
  • 51
  • 7
  • 1
    It's only possible if the iframe is same origin... – Endless Feb 29 '16 at 08:36
  • 1
    Duplicate of http://stackoverflow.com/questions/1452871/how-can-i-access-iframe-elements-with-javascript More dives in http://stackoverflow.com/questions/1654017/how-to-expose-iframes-dom-using-jquery – Prameet Jain Feb 29 '16 at 08:42
  • if the iframe is same origin then use `document.querySelector('iframe').contentWindow` – Endless Feb 29 '16 at 08:44

1 Answers1

0

What you have described looks like a typical DHTML that could be generated by JS after XHR request. So open the web page e. g. in Chrome, check the Network tab. After the target content has been generated on the page, you will see all requests on the tab, examine them, usually all the data you need to retrieve are shown there (note that some conversion of the data may be necessary).  If you find it then you may just do a XHR with the same parameters to retrieve result. Or another way, you can retrieve the generated HTML content accessing DOM, if the iframe is same origin, as it was mentioned above.

omegastripes
  • 12,351
  • 4
  • 45
  • 96