H5 and APP (Android and IOS) interactive method

 

H5 and APP (Android and IOS) interactive method

var u = navigator.userAgent, app = navigator.appVersion;
var isAndroid = u.indexOf ( 'Android')> -1 || u.indexOf ( 'Linux')> -1; // android terminal or browser uc
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
if (isAndroid) {
  . window toScreeningReport .postMessage (); // toScreeningReport a method h5 and app consultations, named by the app free
} else if (isiOS) {
  . window.webkit.messageHandlers toScreeningReport .postMessage (null); // toScreeningReport H5 and a method app negotiated, named by the app free
}

  

Guess you like

Origin www.cnblogs.com/yz-blog/p/12463008.html