CMS솔루션마켓, 이온디 - 워드프레스, 라이믹스, 카페24, 그누보드, 엑셀

프리랜서 커뮤니티

$.browser.msie undefined 오류

2017년 08월 23일

외부 js 를 포함시켜 사용시


다음과 같이 호출되는 부분에서 정상적으로 동작이 안되서 확인해보니 개발자 도구에서


html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?

'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');

inst._keyEvent = false;


Uncaught TypeError: Cannot read property 'msie' of undefined

가 출력되면서 정상적으로 동작하지 않고 있었다.


구글링을 해보니 


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

jQuery.browser() removed

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 recommend using feature detection with a library such as Modernizr.

jQuery Core 1.9 Upgrade Guide.


라는 답변을 얻었다.


다음과 같이 직접 정의해서 사용하거나


You can check out this solution by AJ. It's pretty straightforward, just copy and paste the following lines 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; } })();


이렇게 포함시켜서 사용할 수 있다. 필자는 포함을 시켰다.


Use the following script tag in your jsp/js file:

<script src="http://code.jquery.com/jquery-1.9.0.js"></script> <script src="http://code.jquery.com/jquery-migrate-1.2.1.js"></script>

this will work for sure.

출처 - http://stackoverflow.com/questions/14923301/uncaught-typeerror-cannot-read-property-msie-of-undefined-jquery-tools

추천한 사람

 
댓글은 로그인 사용자만 작성 가능합니다. 로그인하기