|
用cordova-plugin-inappbrowser插件打开外部页面出错,代码完全使用论坛提供的测试代码,如下:
define(function(require){
var $ = require("jquery");
var justep = require("$UI/system/lib/justep");
//引入corodva插件!
require("cordova!cordova-plugin-inappbrowser");
var Model = function(){
this.callParent();
};
Model.prototype.modelLoad = function(event){
//隐藏掉网址部份
var ref = cordova.InAppBrowser.open('https://www.baidu.com/', '_blank', 'location=no');
// 自定义头部代码
ref.addEventListener('loadstop', function() {
ref.executeScript({
code: "alert('test'); "
+ "var div = document.createElement('div'); "
+ "div.innerHTML = '<h1>js动态创建的div 2</h1>'; "
+ " div.style.background = 'blue'; "
+ " var diva = document.getElementById('userinfo-wrap');"
+" diva.parentNode.insertBefore(div, diva); "
});
});
};
return Model;
});
错误截图:
|
|