Titanium Community Questions & Answer Archive

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

fireEvent in webview doesn't work ?

Hi all,

i want to trigger an event when i the user touch a button on a webview.

But it seems the event is not triggered at all.
Maybe there is some mistake on my Javascript onclick ?
or this don't work on iphone simulator ?

sample of my code :
in App.js :

Ti.App.addEventListener('closeInfoWindow', function(e)
{
  Titanium.API.info('test from App.js');
  infowindow.close();
});

and in my Webview.html

<head>
<script language="JavaScript" type="text/javascript">
 function close()
 {    
   Titanium.API.info('test from webview');
   Ti.App.fireEvent('closeInfoWindow');
 }
</script>
</head>
<body>
  <input id="button" type=image onClick="close()" src="mypicture.png">
</body>

seems that even when i click on the input, the OnClick event is not triggered as i don't see the info "test from webview" in the console.

What the hell ? (need jquery file, or .. ?)

— asked June 29th 2010 by Yann Marzack
  • button
  • fireevent
  • javascript
  • webview
0 Comments

1 Answer

  • Change Ti with Titanium

    And I'm not sure

    Titanium.API.info
    

    is available in webview.

    — answered June 29th 2010 by Dan Tamas
    permalink
    1 Comment
    • Hi,
      Change Ti with Titanium does not work better.
      And yes, i'm sure Titanium.API.info is available in webview, but it doesn't works better as is the onclick javascript function was not triggered.

      So much, there is an example on kitchenSink with webviews -> localEval but it don't works too…

      — commented June 29th 2010 by Yann Marzack
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.