alberto2345 Posted December 24, 2016 Share Posted December 24, 2016 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. Link to comment
ViRuZGamiing Posted December 24, 2016 Share Posted December 24, 2016 executeBrowserJavascript Examples; https://github.com/Jusonex/mtasa_cef_tools/blob/master/webui/src/WebWindow.lua#L180-189 https://github.com/Jusonex/mtasa_cef_tools/blob/master/webui/src/mtaevents.js#L9-L15 Link to comment
alberto2345 Posted December 24, 2016 Author Share Posted December 24, 2016 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. Link to comment
alberto2345 Posted December 25, 2016 Author Share Posted December 25, 2016 (edited) 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 December 25, 2016 by alberto2345 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now