Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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,
    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:

    <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");                                    

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!

— asked August 6th 2010 by Santiago Obando
  • 1.4
  • addeventlistener
  • ipad
  • sdk

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.

    — answered August 8th 2010 by Santiago Obando
    1 Comment
    • I had comments in my html page and removing them all from the page fixed the issue also, using 2.1.4GA on iPad. Thanks!

      — commented November 27th 2012 by Tony Burden
  • Try to change Ti. to Titanium.
    ( I'm not sure will change something)

    — answered August 6th 2010 by Dan Tamas
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.