|
在APP调用浏览器有两种方法:
1.使用openApp
2.使用openWin
两种方法调用浏览器后的效果有一点不同:
1.使用openApp调用浏览器后,如果手机内有多个浏览器,会首先弹出选择浏览器的框
2.使用openWin,直接打开网页,但是不显示地址栏(不能输入url)
安卓平台测试代码:
两个按钮:
- <input type="button" onclick="openApp()" value="openApp"/>
- <input type="button" onclick="openWin()" value="openWin"/>
复制代码 js代码:- function openWin() {
- api.openWin({
- name : 'win_show2',
- url : 'http://www**.**',
- rect : {
- x : 0,
- y : 0,
- }
- })
- }
- function openApp() {
- api.openApp({
- androidPkg : 'android.intent.action.VIEW',
- mimeType : 'text/html',
- uri : 'http://www**.**'
- }, function(ret, err) {
- var msg = JSON.stringify(ret);
- api.alert({
- title : 'openApp',
- msg : msg,
- buttons : ['确定']
- });
- });
- }
复制代码
|
|