onhashchange with IE 9

前端 未结 3 757
春和景丽
春和景丽 2021-01-14 06:30

I have the following code

$(document).ready(function() {
   if (\"onhashchange\" in window) {
      alert(\"The browser supports the hashchange event!\");
           


        
3条回答
  •  抹茶落季
    2021-01-14 07:19

    The new hashchange event in HTML5 is supported by all current browsers; no need to fool your browser into thinking it's IE8.

    This code works in IE 9, FF 5, Safari 5, and Chrome 12 on Win 7:

    
    
        
            
            
        
         
            

    Hash Change Test

提交回复
热议问题