小程序返回上一页
This commit is contained in:
@@ -134,6 +134,7 @@
|
||||
<script type='text/javascript' src='../static/js/wx.js' charset='utf-8'></script>
|
||||
<script type="text/javascript" src="../static/js/trend-charts.js"></script>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?ak=0a7eM0lkIvpKGPiq1bMCfeH7&v=2.0&callback=initMap"></script>
|
||||
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
|
||||
<script type="text/javascript">
|
||||
var Constants = {
|
||||
wwwUrl : '${wwwUrl}',
|
||||
@@ -212,11 +213,35 @@
|
||||
$(function(){initMap();});
|
||||
</#if>
|
||||
|
||||
if (typeof WeixinJSBridge !== "undefined") {
|
||||
WeixinJSBridge.on('menu:back', function () {
|
||||
window.history.back(); // 返回上一页
|
||||
});
|
||||
}
|
||||
// if (typeof WeixinJSBridge !== "undefined") {
|
||||
// WeixinJSBridge.on('menu:back', function () {
|
||||
// window.history.back(); // 返回上一页
|
||||
// });
|
||||
// }
|
||||
// 监听popstate事件,当用户点击浏览器返回键时触发
|
||||
window.addEventListener('popstate', function (event) {
|
||||
window.history.back(); // 返回上一页
|
||||
});
|
||||
|
||||
// // 监听返回按钮的点击事件(适用于部分手机浏览器)
|
||||
// document.querySelector('.previous a').addEventListener('click', function () {
|
||||
// history.back(); // 返回上一页
|
||||
// });
|
||||
//
|
||||
// // 模拟点击返回按钮返回上一页
|
||||
// window.onpopstate = function(event) {
|
||||
// if (event.state) {
|
||||
// window.history.back(); // 返回上一页
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// // 按钮触发时更新历史记录
|
||||
// document.querySelector('.previous a').addEventListener('click', function() {
|
||||
// history.pushState(null, null, location.href);
|
||||
// window.history.back(); // 返回上一页
|
||||
// });
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user