I don't understand why if(this.external && this.hostContainer) returns true when my PDF is embedded in an HTML document, but if I change the file to an HTA (trusted) document, this.external is still true, but this.hostContainer returns undefined. Since an HTA is just a trusted web page running on IE, why doesn't the hostContainer property work? Is there a workaround?
You're using this.hostContainer as a boolean, but it's not.
You better try something like this instead:
this.hostContainer != undefined
No, it does work inside an HTML document as the undefined evaluates to false. If I change the HTML page into an HTA page, this.hostContainer has no properties and is undefined when it should not be.