Javascript Benalman Js不能在Ipad上工作。杂凑变化
我使用返回按钮控制窗口重定向url到主页 我在普通浏览器和安卓手机上进行了测试,它可以正常工作。 但它在Ipad上不起作用 这是代码的一部分Javascript Benalman Js不能在Ipad上工作。杂凑变化,javascript,android,jquery,ios,ipad,Javascript,Android,Jquery,Ios,Ipad,我使用返回按钮控制窗口重定向url到主页 我在普通浏览器和安卓手机上进行了测试,它可以正常工作。 但它在Ipad上不起作用 这是代码的一部分 <!DOCTYPE html> <html> <meta name="viewport" content="width=device-width, initial-scale=1"> <script src="jquery.min.js"></script> <script src="jqu
<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="jquery.min.js"></script>
<script src="jquery.ba-hashchange.min.js"></script>
<script>
// control back button
// includes in js mean contains
if(!window.location.href.includes('#state')){
history.pushState(null ,document.title, '#state'); // forwards
}
// Bind an event handler.
jQuery(window).bind('hashchange', function(e) {
window.location = _contextPath + "/home/";
});
</script>
</html>
//控制返回按钮
//包含在js平均包含中
如果(!window.location.href.includes('#state')){
history.pushState(null,document.title,#state');//转发
}
//绑定事件处理程序。
jQuery(window).bind('hashchange',函数(e){
window.location=_contextPath+“/home/”;
});
我注意到,在Ipad中,url不会附加“#state”。
我怀疑history.pushState在Ipad中不起作用
我怎样才能解决这个问题
谢谢我换衣服后问题解决了
includes
到
与Benalman Js库无关。可以排除此js
多谢各位
indexOf