How can I open a URL in external browser using Phonegap+cordova in sencha touch app for ios?

扶醉桌前 提交于 2019-12-08 10:04:22

问题


I'm building a sencha touch app for ios. In order to open URL in external browser , I have included phonegap and cordova. I tried using both this functions to open URL.but didn't work.please help me.

 Ext.device.Device.openURL('http://www.bing.com');

 navigator.app.openUrl('http://www.bing.com',{ openExternal:true });

回答1:


Simple window.open('http://www.google.com') should work and if you want to open the web page in a browser instance within your app, you should consider using InAppBrowser Plugin which uses same window.open and degrade gracefully to default




回答2:


For me, window.open() didn't work in all cases. Another solution is assign the URL to window.location. Example for opening an external Url using a button:

Ext.Button.create({
            xtype: 'button',
            text: 'open url',       
            handler: function () {  
        window.location = "http://www.google.com";
            });


来源:https://stackoverflow.com/questions/16454263/how-can-i-open-a-url-in-external-browser-using-phonegapcordova-in-sencha-touch

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