js 调用原生方法

前端调用 原生app 方法,通过 iframe 唤起 native

if( navigator.userAgent.indexOf('iPhone') >= 0 ) {
    var ifr = document.createElement('ifrmae');
    ifr.src = 'xx://postToken';
    ifr.style.display = 'none';
    document.body.appendChild(ifr);
}

// 执行完成后的回调
function sendTokenToWrap ( token ) {
    // 返回值
    alert( token )
}

猜你喜欢

转载自www.cnblogs.com/_error/p/9198396.html
今日推荐