Discussion:
Loading an htmlfile object from text - how to disable embedded scripts ?
(too old to reply)
R.Wieser
2019-05-08 07:41:11 UTC
Permalink
Hello all,

I'm trying to search thru a HTML string as if its a DOM document. For
that I create an "htmlfile" object and ".write" the string into it. So far,
so good. The problem is that I get a warning dialog asking me if I want
to run the embedded scripts in it. Which ofcourse I do not want and also
throws a wrench in the automation process (needs human intervention).

The full script looks like this:
Set oDOM = CreateObject("htmlfile")
oDOM.Write sData
oDOM.Close

Questions:

1) Where can I find documentation on the VBScript "htmlfile" object ?
Half an hours worth googeling for "htmlfile" plus a combination of other
keywords or even for the objects classid (taken from the registry) gets me
nowhere.

2) How do I tell it to ignore (not run) any-and-all active content (just
load the text for DOM parsing) ?

Regards,
Rudy Wieser
Mayayana
2019-05-08 12:50:07 UTC
Permalink
This post might be inappropriate. Click to display it.
R.Wieser
2019-05-08 16:29:36 UTC
Permalink
This post might be inappropriate. Click to display it.
JJ
2019-05-08 14:17:42 UTC
Permalink
Post by R.Wieser
1) Where can I find documentation on the VBScript "htmlfile" object ?
Half an hours worth googeling for "htmlfile" plus a combination of other
keywords or even for the objects classid (taken from the registry) gets me
nowhere.
The "htmlfile" ProgID is actually the HTMLDocument object. It implements
IHTMLDocument, IHTMLDocument2...IHTMLDocument8 along with other interfaces.
Post by R.Wieser
2) How do I tell it to ignore (not run) any-and-all active content (just
load the text for DOM parsing) ?
HTMLDocument object doesn't run any script. It's only a representation of
the DOM, and adding/injecting SCRIPT elements won't execute the code it
contains, or load the external resource it referenced. The browser is not
involved on this matter.
Continue reading on narkive:
Loading...