码迷,mamicode.com
首页 > Web开发 > 详细

js 调用原生方法

时间:2018-06-19 14:44:48      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:user   返回   nat   post   sendto   tee   iframe   spl   col   

前端调用 原生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 )
}

 

js 调用原生方法

标签:user   返回   nat   post   sendto   tee   iframe   spl   col   

原文地址:https://www.cnblogs.com/_error/p/9198396.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!