Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Obtaining full HTML source from WebBrowser control
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00647241
Message ID:
00652073
Views:
21
>>>If you want the source, get it directly from the URL using winsock or wwipstuff :-)
>>
>>Interesting point, Gérald. I'll take your word for it that even document.documentElement.outerHTML is not quite exactly what I was looking for. But there is still one way that would seem to do the trick, assuming that the prompt can be suppressed, which is to use the document.execCommand('SaveAs') method. Note that the scenario of interest to me is one that begins with a WebBrowser control, already navigated to the page in question. I would expect to encounter all sorts of complications trying to get back to that page via winsock or wwipstuff, e.g. if it had been dynamically generated in response to a form, or there had been some password manually entered prior to getting to this page.
>>
>>Mike
>
>Using the document's methods and properties you will get all the content of the document, but parsed by the control. What i said was that if you wish to get the "original" page, you are out of luck with the control.
>
>BTW, what are you tryng to get that is not there?

Gérald,

I believe you are mistaken, at least in the case of the document.execCommand('SaveAs') method. My guess is that it is obtaining the HTML from the browser cache, just as the View Source command appears to be doing. It may be other document methods and properties do indeed entail the sort of changes you describe, but this is not what seems to occur with SaveAs. I confirmed this by conducting exactly the experiment that you proposed.

Considering the complications that I mentioned about password protected web sites and dynamically generated pages, not to mention the cost of an extra trip across the Internet, I would be inclined to do as much as I can with whatever the WebBrowser control has to offer. Vlad's solution seems acceptable for most purposes, but I'm not sure if and when the changes it might introduce (which you pointed out) would have any significance.

Ideally, this is something I shouldn't have to think about. My objective is simply to be able to save the exact source of an HTML page, without having to make the judgement as to whether some particular way of altering it into an "equivalent" form is acceptable. I'm constructing a general-purpose utility, not a specialized application, so there are no a priory assumptions about what sort of page I might encounter.

Mike
Montage

"Free at last..."
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform