Ti.App.addEventListener not working for iPad (on the actual device)
I'm trying to load dynamic data in a local html page using a web view:
var webview_dynamic = Titanium.UI.createWebView({
url: 'recetas.html',
borderColor: '#f7f0e3',
borderWidth: 5,
visible:false,
scale: true
});
I'm calling the event like this from a list:
Ti.App.fireEvent("loadPage", { titulo: dataRecetas[e.index].titulo});
and then in the page recetas.html I have this in the head:
<head>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
Ti.App.addEventListener("loadPage", function(e)
{
alert("loadPage works");
});
});
</script>
</head>
the alert is not shown succesfully, it only is when I do it in the simulator, but not in the actual device, it was working fine with version 1.3, but now with sdk 1.4 it does not seem to work. Please help!
2 Answers
-
That didn't work for me, but finally found the fix.
In my local html page I had lots of html comments ( <!– comment –> ) spread throughout the page, after trying different things, it seems like the device doesn't like those comments, so I just removed them and that made it work.
This might be a bug.
-
Try to change Ti. to Titanium.
( I'm not sure will change something)