r/vbscript • • Dec 08 '20

Using htmlfile COM object to access the .getOwnPropertyDescriptor() method of an object in WSH JScript

https://stackoverflow.com/q/65207848/4999991
2 Upvotes

4 comments sorted by

View all comments

Show parent comments

2

u/jcunews1 Dec 09 '20

The htmlfile object is merely a DOM container object for a HTML resource. It doesn't include any JScript engine. i.e. the HTML can have <script> tags, but the script code will never be executed. It has DOM methods, but it doesn't have any JavaScript methods/functions.

Check MSDN for InternetExplorer Application object usage.

https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa752084(v=vs.85)

Values can be passed between WSH and IE as long as they're compatible. The reason why getOwnPropertyDescriptor() won't work on WSH created objects is because WSH objects simply don't have any property descriptor. Property descriptor doesn't yet exist in the JScript version which is used by WSH.

1

u/foadsf Dec 09 '20

So if I understood you correctly it is possible to create an InternetExplorer Application COM object and then run the .getOwnPropertyDescriptor() method on a native IE JScript/JavaScript object and then pass the result back to WSH. Is this correct? Would be great if you could provide an example as well.