首页 > 代码库 > ios协议调起app

ios协议调起app

function openIos(url, callback) {    if (!url) {        return;    }    var node = document.createElement(‘iframe‘);    node.style.display = ‘none‘;    var body = document.body;    var timer;    var clear = function(evt, isTimeout) {       (typeof callback===‘function‘) &&  callback(isTimeout);        window.removeEventListener(‘pagehide‘, hide, true);        window.removeEventListener(‘pageshow‘, hide, true);        if (!node) {            return;        }        node.onload = null;        body.removeChild(node);        node = null;    };    var hide = function(e){        clearTimeout(timer);        clear(e, false);    };    window.addEventListener(‘pagehide‘, hide, true);    window.addEventListener(‘pageshow‘, hide, true);    node.onload = clear;    node.src = http://www.mamicode.com/url;>

  

ios协议调起app