上述腳本按序引入,在後續執行js:html
window.chrconfig = { "isShare": true, "shares": { "shareTitle": "分享標題", "shareContent": "分享內容", "shareImageUrl": "圖片url", "shareUrl": "分享出去的連接" } }; var active = new window.AppInteractive(chrconfig); active.wxShare();
active.wxShare();
var apitype = 0; //判斷環境 if (!!window.webkit && !!window.webkit.messageHandlers && !!window.webkit.messageHandlers.chinahr) { apitype = 2; //ios5.4.2+ } else { if (!!window.chinahr) { apitype = 1; //andriod及ios低版本 } else { apitype = 0; //非app環境 } } if (apitype !== 0) {//app環境 $('a').on('click', function (e) { var href = $(this).attr('href'); e.preventDefault(); if (href.indexOf('job') > -1) { // 職位 var id = href.split('job/')[1].split('.html')[0]; var message = "chinahr://customer/job?id=" + id + ""; if (apitype == 2) { window.webkit.messageHandlers.chinahr.postMessage(message); } else if (apitype == 1) { window.chinahr.gotoPage_callback(message, ""); } } else if (href.indexOf('company') > -1) { // 公司 var id = href.split('company/')[1].split('.html')[0]; var message = "chinahr://customer/company?id=" + id + ""; if (apitype == 2) { window.webkit.messageHandlers.chinahr.postMessage(message); } else if (apitype == 1) { window.chinahr.gotoPage_callback(message, ""); } } }); }
注意事項:web