I am unable communicatefrom a WebView to Titanium using Alloy? It seems like it worked in the past Ti.App.fireEvent(), but in a new Alloy project it does not work. Yes, I've read these docs, but they seem to be out of date: https://wiki.appcelerator.org/display/guides/Communication+Between+WebViews+and+Titanium When using alloy there is no app.js file - only a alloy.js file. If anyone has an example of this working in ALLOY this would be great! Here is what I have tried.
webview.html
<html>
<head>
<script type="text/javascript">
function fire(e){
alert("Before Ti.App.fireEvent");
Ti.App.fireEvent("fromWebview",{});
alert("After Ti.App.fireEvent");
}
</script>
</head>
<body>
<a href="#" onClick="fire()">Click this link to execute the fire() function</a>
</body>
</html>
index.xml
<Alloy>
<Window id="w_history">
<WebView id="webview" url="/webview.html" />
</Window>
</Alloy>
index.js
Ti.App.addEventListener('fromWebview',function(e){
alert("Clicked from Web");
});
$.w_history.open();
f I run the code only die alert before the Ti.App.fireEvent fires - the alert after does not? I guess this means the Ti.App.fireEvent is not being executed and breaks the function?
I have been stuck on this the whole day! Any help would be appreciated! Thanks