Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Embedding Javascript
Mon, May 2 2016 2:23 PMPermanent Link

Trinione

Hi:
I know JavaScript can be added via the 'external' interface. However, there are occasions I would like to include the JS file within my code via a TBrowser.

Can a function that's been loaded via Browser1.DocumentText be called?

In the demo file that would be Sum(1,2).

Thanks.
Mon, May 2 2016 2:23 PMPermanent Link

Trinione

Forgot to attach the Demo file. Here it is.



Attachments: external-element.zip
Wed, May 4 2016 4:32 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com


<< Can a function that's been loaded via Browser1.DocumentText be called?  >>

Yes:

http://stackoverflow.com/questions/251420/invoking-javascript-code-in-an-iframe-from-the-parent-page

and no.  The "no" part is that you need to prototype the function as a method call of the content window of the frame element, and this is not an easy task.  It involves messing around with the standard WebDOM unit so that you can inject your function as a method of the content window's class interface.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, May 4 2016 10:49 PMPermanent Link

Trinione

Thanks....... I am sticking with 'No' as the answer. Smile
Image