I have a feature in my web app that can appear within its own Window (thus its own WebDocument) or within an IFrame of its parent window.
I've written a bunch of code in my framework to handle getting some variable info from my web app's WebDocument object using ExecuteScript. It works fine when its in its own WebDocument, but fails when embedded in the IFrame.
I realize why, because I'm using code like this:
StrValue = MyWebDocObj.ExecuteScript("return MyVar;")And of course when embedded in the IFrame, it isn't looking at that.
So, I can also do this:
If Embedded then StrValue = MyIFrameObj.ExecuteScript("return MyVar;") Else StrValue = MyWebDocObj.ExecuteScript("return MyVar;") End ifBut I have a lot of places with executescript calls, and what I'd really like to do is make it more generic so that it will work without a condition. Is it possible to do this?
StrValue = MyGeneralObj.ExecuteScript("return MyVar;")Where MyGeneralObj works for either a WebDocument or an IFrame.