Results 1 to 3 of 3

Thread: Make the <href tel:> to work?

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    4

    Default Make the <href tel:> to work?

    Can Sencha Touch 2 make <a href="tel:+18009999999">call me</a> to work? I searched a little bit. To make a phone call through an app, I have to use PhoneGap. Some posts say it's a security reason. If so, can someone explain why phonegap can do it but not sencha touch?

    Thanks.

    ttk

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379

    Default

    This was because ST2 wasn't allowing it. We are aware of it and will get fixed before final release.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3
    Sencha User
    Join Date
    Aug 2011
    Location
    Cedar Rapids, IA
    Posts
    63

    Default

    While href:tel may not be working right now you do have other options. For instance the following is example of what is working for me:

    Code:
    Ext.define('Test.view.Test', {
        extend: 'Ext.Panel',
        alias: 'widget.test',
    
    
        config: {
            fullscreen: true,
            layout: {
                type: 'vbox'
            }
        },
    
    
        initialize: function() {
            var me = this;
            me.setItems([
                {
                    xtype: 'panel',
                    html: '<div>Phone: <span style="text-decoration: underline !important;" class="link" data-link="tel:+18887362421">1 (888) 736-2421</span></div>',
                    styleHtmlContent: true,
                    listeners: [
                        {
                            event: 'show',
                            scope: this,
                            fn: this.onPanelShow
                        }
                    ]
                }
            ]);
            me.callParent(arguments);
        },
    
    
        onPanelShow: function(component, options) {
            component.getEl().on({
                tap: function(event) {
                    var location = event.getTarget().getAttribute('data-link');
                    window.location = location;
                },
                delegate: '.link'
            });
        }
    });
    The important part here is listening for 'tap' on the components element and then using a delegate to specify exactly what item you want to listen for. In this case I'm listening for the tap event on any child elements with a class = 'link'.

    Hope this helps

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •