问题
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