3 Replies Latest reply on May 10, 2016 1:02 PM by kerrishotts

    Android dynamically added livelinks not working

    wwolfc

      I'm using Phonegap 5.5.0, and trying to dynamically add anchor links based on AJAX json response data, using for example this code snippet:

       

      Html:

       

          <div class="profileData col-xs-12 col-sm-6" id="phoneNumber">

              <figure><img id="phoneNumberImage" alt="Phone number" src="img/profile_picto_phone.png"/></figure>

              <span></span>

          </div>

       

      jQuery:

       

          $("#phoneNumber span").append("<a>" + data.profile.tel + "</a>").click(function() {

              window.location.href = 'tel:' + data.profile.tel;

          });

       

      This works fine in iOS, and also works in Android with a hardcoded link using no jQuery like this:

       

          <a onClick="window.location.href='tel:12345678'">12345678</a>

       

      It's like the links are not interpreted anymore because they're being added dynamically. I already tried adding .trigger('create') as some other posts suggested but no success. The links appear in my Android app, but clicking on it triggers nothing. No logs in Android Studio except for:

       

          V/WebViewInputDispatcher: blockWebkitDraw

          V/WebViewInputDispatcher: blockWebkitDraw lockedfalse

          D/webview: blockWebkitViewMessage= false

       

      My phonegap config.xml contains:

       

          <allow-intent href="tel:*" />

          <allow-intent href="mailto:*" />

          <uses-permission android:autoLink="email" />

          <uses-permission android:autoLink="phone" />