Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-9991

Android: links inside a WebView don't work with some particular text length

    Details

      Description

      Problem description

      Some links inside a WebView with Android 4.0.4 are not working. The problem seems to be related to the length of the text inside the link.

      Steps to reproduce

      • Create an app with the files below
      • Run the app on Android 4.0.4
      • Click the links

      app.js

       
      var win1 = Ti.UI.createWindow({
          title: 'string',
          backgroundColor: '#fff',
          layout: 'vertical'
      });
       
       
      var file = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'test2.html');
      var markup = file.read ().toString ();
       
      var wv1 = Ti.UI.createWebView ({
          top: 0,
          left: 0,
          right: 0,
          bottom: 0,
          scalesPagesToFit: true, 
          //lightTouchEnabled: false, 
          enableZoomControls: false,
          html: markup
      });
       
      win1.add (wv1);
       
      win1.open ();
      

      test2.html

      <!DOCTYPE html>
      <html>
      <head>
      <title>Test</title>
      <meta name="viewport" content="width=320, user-scalable=no, target-densitydpi=device-dpi"/>
      </head>
      <body>
      <div>
       
      <script type="text/javascript">
      function clickhandler (msg) {
         alert (msg);
      }
      </script>
       
      <p>Test 1:</p>
      <a href="#" onclick="clickhandler ('1'); return false;">XXXX XXXXX XXXXX XX<br />
      XXX XXX<br />
      XXXXXXX, XX XXXXX</a>
       
      <p>Test 2:</p>
      <a href="#" onclick="clickhandler ('2'); return false;">2109 Avent Ferry Rd<br />
      Ste 110<br />
      Raleigh, NC 27606</a>
       
      <p>Test 3:</p>
      <a href="#" onclick="clickhandler ('3'); return false;">2109 Avent Ferry Rd, Ste 110<br />
      Raleigh, NC 27606</a>
       
      <p>Test 4:</p>
      <a href="#" onclick="clickhandler ('4'); return false;">line 1 line 1 line 1 line 1<br />
      line 2 line 2 line 2 line 2<br />
      line 3 line 3 line 3 line 3</a>
       
      </div></body></html>
      

      Expected behavior

      All the links work well

      Current behavior

      The first two links are not working; the user just gets a visual feedback, but the javascript function is not called.

      Additional links

      I've found a problem that looks similar: http://code.google.com/p/android/issues/detail?id=33651

      Customer ticket

      http://support.appcelerator.com/tickets/APP-618179

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sunila Sunila
                Reporter:
                dcassenti Davide Cassenti
                Reviewer:
                Hieu Pham
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-5400
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration