Sign in to follow this  
alberto2345

Executing javascript from an iframe in the browser

Recommended Posts

I'm wanting to know if there is a way to execute javascript functions from MTA to an iframe that is being shown in the browser.

When I try and execute the function, it says it isn't defined.

 

Thanks.

Share this post


Link to post

That's not working as I'm trying to execute javascript code from an iframe within the browser itself. I can execute javascript code from the parent, but not from an iframe within the html page.
 

 

Share this post


Link to post

All good, came up with a solution to the issue.

What I did was create a function in the main javascript file that would access the iframe and execute the function through that. This is achieved using:

appFrame.contentWindow.functionName(passingObj);

(in my case anyway)

However I feel this isn't the best way to achieve this since its using an, in my opinion, unnecessary "piggyback". If there is a better method to do this, please let me and everyone else know. Otherwise I would suggest adding a way to do this through an MTA function that would work better.

Thanks

Edited by alberto2345

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.