最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - msie issue with JS Hashchange Event - Stack Overflow

programmeradmin3浏览0评论

I am trying to load my wordpress based website with AJAX following this Tutorial. All of the code makes sence to me but they are using a plugin called JS Hashchange Event. The issue I am having is that in part it uses the $.browser.msie so when I run it with jQuery 1.9 I get a Uncaught TypeError: Cannot read property 'msie' of undefined error. I tried adding the js migrate plugin but it did not work. I read that I could add this bit of code

jQuery.browser={};(function(){jQuery.browser.msie=false;
jQuery.browser.version=0;if(navigator.userAgent.match(/MSIE ([0-9]+)\./)){
jQuery.browser.msie=true;jQuery.browser.version=RegExp.$1;}})();

but not sure where to put it. Anyone had this issue? Or maybe a better way to use AJAX with loading wordpress pages (keep the header and footer static)?

I am trying to load my wordpress based website with AJAX following this Tutorial. All of the code makes sence to me but they are using a plugin called JS Hashchange Event. The issue I am having is that in part it uses the $.browser.msie so when I run it with jQuery 1.9 I get a Uncaught TypeError: Cannot read property 'msie' of undefined error. I tried adding the js migrate plugin but it did not work. I read that I could add this bit of code

jQuery.browser={};(function(){jQuery.browser.msie=false;
jQuery.browser.version=0;if(navigator.userAgent.match(/MSIE ([0-9]+)\./)){
jQuery.browser.msie=true;jQuery.browser.version=RegExp.$1;}})();

but not sure where to put it. Anyone had this issue? Or maybe a better way to use AJAX with loading wordpress pages (keep the header and footer static)?

Share Improve this question asked Oct 23, 2013 at 0:12 PackyPacky 3,5839 gold badges56 silver badges90 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 16

The $.browser has been removed as of jQuery 1.9.

Straight from the docs: $.browser

The jQuery.browser() method has been deprecated since jQuery 1.3 and is removed in 1.9. If needed, it is available as part of the jQuery Migrate plugin. We remend using feature detection with a library such as Modernizr.

You can use the jQuery migrate plugin to restore removed functionality if needed. If it didn't work, you can try using Ben Alman's hashchange plugin, and replace $.browser.msie with (document.documentMode != undefined).

There is an update of this script, Please refer the URL : https://github./georgekosmidis/jquery-hashchange

2013-29-11 fix: As of jQuery 1.9 $.browser used in Ben's code isn't supported anymore.

发布评论

评论列表(0)

  1. 暂无评论