Fire 'tel' link from button in Sencha Touch

守給你的承諾、 提交于 2019-12-03 08:46:37

It's pretty simple,

All you have to do is change the document's location (window element) in the button's handler:

        var tapHandler = function(button, event){
            Ext.Msg.confirm('External Link', 'Call ' + button.contactName + "?", function(res){
                if (res == 'yes') {
                    window.location = button.callUrl;
                }
            }, this);

        };


        var callButton = new Ext.Button({
            text: 'Call Now',
            callUrl: 'tel:995223423',
            contactName: 'Ben M',
            handler: tapHandler
        });

Haven't tried this, but if Rubinsh's method doesn't work try creating it programmatically in the button's click handler.

function(){
   var alink = Ext.getBody().createChild({tag: 'a', href: 'tel:#########'});
   var event = document.createEvent("TouchEvent");
   event.initTouchEvent('tap', true, true, window, 0, 0, 0, 0);
   alink.dispatchEvent(event);
}

References

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!