For example, if you go to http://www.cnn.com
The page must be successfully rendered at least once. This allows the page to get its appearance. Once it has rendered, I want the rendered contents version (which will be different than the Document.DocumentSource version).
I've tried a call like this:
Source: IHTMLDocument2): String;
colScripts := ASource.scripts as IHTMLElementCollection;
for x := 0 to colScripts.length - 1 do
myScript := colScripts.item(x, '') as IHTMLScriptElement;
myScript.Text := '';
slData := TStringList.Create();
SaveDocToStrings(ASource as IDispatch, TStrings(slData));
Result := slData.Text;
How do I get an exact rendered copy? I completely understand that some functionality will be lost with this method, and I'm fine with that. For example, onMouseOver events that call a function in a script block will no longer function. I do not need page functionality, I only need appearance.
Also, a method to remove script data from intrinsic events.. not covered in the test code above, as it wouldn't fit or be under document.scripts.