diff --git a/public/res/year-statistic/index.html b/public/res/year-statistic/index.html index abb6d762..ffd5f76b 100644 --- a/public/res/year-statistic/index.html +++ b/public/res/year-statistic/index.html @@ -1530,12 +1530,15 @@ } // 返回按钮功能 - function goBack() { - if (window.history.length > 1) { - window.history.back(); - } else { - // 如果没有历史记录,关闭窗口或跳转到默认页面 - window.close(); + function goBack(){//h5返回APP + let data = {"action":"goBack","params":""} + var u = navigator.userAgent; + var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); + // var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端 + if(isiOS){ + window.webkit.messageHandlers.nativeObject.postMessage(data); + }else { + window.android.sendMessage("goBack"); } }