Link to home
Start Free TrialLog in
Avatar of minermadison
minermadison

asked on

How can I remove all scripts from a document using MSHTML?

Hi,
   I have an HTML document loaded in to a mshtml.IHTMLDocument2 class. I would like to remove all javascript (and vb script) from the document. I can remove all script BLOCKS using the HTMLDocument.scripts collection, that works great for removing <script> blocks, but inline script like the following remain.

<SELECT onchange="location = xyz.com">

How can I remove all onSomeEvent functions from every element in the document?
Is there anyway to access a collection of the element event scripts?

Thanks in advance... and if possible I would really like a solution that does not traverse all the elements in the document.



ASKER CERTIFIED SOLUTION
Avatar of mailBoy2
mailBoy2
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial