function goUrl(){
var i =0;
sessionStorage.setItem('goto_url','<%=goto_url%>');
channelCode = window.sessionStorage.getItem("channelCode");
if (channelCode == 18){//手机银行跳转,登陆
debugger ;
alert("1");
if(window.localStorage.resId1 == 1){ //安卓
alert("2");
window.app_score.toLoginPhone();//调用安卓的原生方法
window.loginInPhone=loginInPhone;//回调方法
function loginInPhone(data){
if(data != '' && data != null && data != undefined) {
if(typeof(data) == "string"){
data = JSON.parse(data);
}
}
}
}else{//IOS
alert("3");
function setupWebViewJavascriptBridge(callback) {
if(window.BOCWebViewJavascriptBridge) {
return callback(BOCWebViewJavascriptBridge);
}else{
document.addEventListener('WebViewJavascriptBridgeReady',function(){callback(BOCWebViewJavascriptBridge);},false);
}
if(window.WVJBCallbacks) {
return window.WVJBCallbacks.push(callback);
}
window.WVJBCallbacks = [callback];
var WVJBIframe = document.createElement('iframe');
WVJBIframe.style.display = 'none';
WVJBIframe.src = 'wvjbscheme://__BRIDGE_LOADED__';
document.documentElement.appendChild(WVJBIframe);
setTimeout(function() {
document.documentElement.removeChild(WVJBIframe);
}, 0);
}//以上的代码是固定的,只要是交互就需要写
setupWebViewJavascriptBridge(function(bridge){
//所有的和app交互的代码都在这方法填写
bridge.registerHandler('loginInPhone',function(data,responseCallback){//注册回调方法
if(data != '' && data != null && data != undefined) {
if(typeof(data) == "string"){
data = JSON.parse(data);
}
}
//toLoginPhone为ios端register的handleName
bridge.callHandler('toLoginPhone', function(){}); //调用手机银行的原生方法
//网上说calllback是处理返回数据的方法,可是没有啊!!!!
bridge.init(function(message,responseCallback){
var data = {'Javascript Responds':'Wee!'};
responseCallback(data);
});
});
}
)}
var ticket = data.ticketInfo;//票
var clientId = data.CID;//客户id
var slientId = data.SID;//用户id
var card = data.card;
//window.location.href="${pageContext.request.contextPath}/mobilePage/login/login.jsp";
window.location.href="${pageContext.request.contextPath}/bankLoginMobileCode.do?ticket="+ticket+"&clientId="+clientId+"&SlientId="+SlientId+"&card="+card;
}
}
这是h5的js调用但是 没有调起来app的方法,求大神给答案!!!