Hi guys, bit of an odd one here I think.
So, a little bit of context, I've got revBrowserAddJavaScriptHandler to work with a simple html document I've created, and I'm now trying to integrate it with an existing webpage that's much more complex.
The issue I'm having currently is pretty simple- adding any handler and calling it from the JS doesn't trigger any handlers in LiveCode itself. I've been thinking about this (read as: banging head on wall) for the better part of a day now, and I have a feeling it's due to the webpage rather than LiveCode itself. The webpage is built on the Zend framework and is based around MVC.
What I imagine is happening (although I'm completely speculating here, feel free to tell me I'm wrong) is one of two things. Either the LiveCode browser inserts a JS script into each page it visits, or it traps any errors referencing the liveCode.myHandler that it finds. I'm leaning towards the first one, as that's making me think that LiveCode can't insert the script into the HTML document because of some of the funky MVC stuff going on.
Anyway, any thoughts or ideas? I'm very aware that I've just written this out, and I'll probably find a stupid spelling mistake in the code in a minute...
How does revBrowserAddJavaScriptHandler actually work?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: How does revBrowserAddJavaScriptHandler actually work?
Right, so I found that if the webpage is navigated away from, then the JS Handler gets removed- yet I cannot see this documented anywhere. Is it intended functionality, or a bug?
Re: How does revBrowserAddJavaScriptHandler actually work?
Hi Giodev,
I see you have been via support with this query, but it will be more effective to answer here as it will help others in the community.
I have spoke to our dev, who implemented revBrowserAddJavaScriptHandler and he mentions the following-
If you are looking for some more in-depth information on how revBrowser and its handlers work, you can get into the nitty gritty by looking at the LiveCode source on github
I hope this gives you some leads.
Kind Regards,
Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
-
I see you have been via support with this query, but it will be more effective to answer here as it will help others in the community.
I have spoke to our dev, who implemented revBrowserAddJavaScriptHandler and he mentions the following-
The last statement should give an explanation for your latest commentThe liveCode object and its handlers is added by making native calls to directly access the Javascript VM. It doesn’t touch the page source or insert any scripts.
The javascript handlers need to be re-added when the browser navigates to a new page - you can handle the browserNavigateComplete message to deal with this and set the javascript handlers there.
If you are looking for some more in-depth information on how revBrowser and its handlers work, you can get into the nitty gritty by looking at the LiveCode source on github

I hope this gives you some leads.
Kind Regards,
Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
-
Re: How does revBrowserAddJavaScriptHandler actually work?
Thanks LCNeil, that's very useful information, more than happy to have the response here, hopefully it'll help someone else one day!
Accessing the VM is a much better idea than my thinking, some how I missed that one in my thought process...
Thanks again, very much appreciated
Accessing the VM is a much better idea than my thinking, some how I missed that one in my thought process...
Thanks again, very much appreciated
