2017-02-28 62 views
0

我使用Benalman JS來控制後退按鈕窗口重定向url到家。Benalman Js不在iPad上工作。 hashchange

我在正常的瀏覽器和Android手機上測試過,因此工作。 但它在Ipad中不起作用,

這裏是代碼的一部分。

<!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> 

我注意到,在ipad的url不會追加「#狀態」。 我懷疑history.pushState在Ipad中不起作用。

我該如何解決這個問題?

謝謝

回答

0

固定的問題後,我改變

includes 

indexOf 

無關,與Benalman JS庫。這js可以排除。

謝謝。