Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13923] Android: WebView click events do not fire when distributed to device

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-10-22T22:22:19.000+0000
Affected Version/sRelease 2.1.1
Fix Version/s2013 Sprint 12 Core, 2013 Sprint 12, Release 3.2.0
ComponentsAndroid
Labelsmodule_webview, supportTeam
ReporterJamie Buckley
AssigneeAllen Yeung
Created2013-05-20T21:23:02.000+0000
Updated2013-10-22T22:22:24.000+0000

Description

When building the app for distribution on Android. Click events on web view are no longer fired, however when building for development the app works fine. This occurs when adding a click event to a webview app.js
var webView = Titanium.UI.createWebView({
    scalesPageToFit : true,
    left : 0,
    width : '100%',
    showScrollbars : false,
    willHandleTouches : false,
    disableBounce: true,
    anchorPoint: {
        x: 0.5,
        y: 0.5
    }
});

var html = '<html>' + 
    '<head>' +
       '<meta name="viewport" content="width=device-width,user-scalable=yes,initial-scale=1">' +
       '<script src="lib/web/Mmf/global.js"></script>' + 
   '</head>' + 
   '<body>' +
       '<a href="javascript:clickme()">Click here</a>' +
   '</body>' + 
   '</html>';
webView.html = html;
globals.js
function clickme() {
    alert('Click!');
}

Attachments

FileDateSize
webViewClick.zip2013-05-21T16:50:48.000+00009694352

Comments

  1. Eduardo Gomez 2013-05-21

    I attempted to use sample attached. Works on 3.1.0.GA, anything below does not:

    2.1.1.GA

       05-21 12:21:02.795: I/TiWebChromeClient.console(17948): (main) [26603,58379] Uncaught ReferenceError: clickme is not defined (1:)
       

    2.1.5.v20130226113056

       05-21 12:23:30.514: I/TiWebChromeClient.console(18340): (main) [2676,4729] Uncaught ReferenceError: clickme is not defined (1:) 
       
  2. Allen Yeung 2013-06-04

    [~egomez], for the scenario you are talking about, I would try the first approach that I mentioned. From the use case description, it looks like you will need to disable minification completely. When testing those PRs, I would make sure you have the SKIP_JS_MINIFY environment variable defined. Let me know if that works.
  3. Ingo Muschenetz 2013-06-07

    Going to resolve this as fixed.
  4. Federico Casali 2013-10-22

    Verified fixed. TiSDK 3.2.0.v20131022050844 CLI 3.2.0 Android Galaxy Note II 4.1.2 Android Google Nexus Galaxy 4.3 Closing.

JSON Source