jQuery oembed 플러그인 - 오류 : 객체는이 속성 또는 방법을 지원하지 않습니다.

StackOverflow https://stackoverflow.com/questions/1627790

문제

현재 다음 jQuery 플러그인을 사용하고 있습니다 : jQuery oembed. 이 플러그인은 FF, Chrome 및 Safari에서 훌륭하게 작동합니다. 그러나 IE7에 문제가 있습니다. 코드를 매우 맨손으로 제거했지만 다음과 같은 오류를 일으키는 원인을 알 수 없습니다.

Error: Object doesn't support this property or method.

오류가 참조하는 선은 다음과 같습니다.

  $("#container").oembed("http://www.youtube.com/watch?v=nue4pvzuyOo");

다음은 내 HTML입니다 (다시, 매우 기본) :

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
    <title>jquery-oembed explicit insert example</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>    
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>  
    <script type="text/javascript" src="oe.js"></script>
  </head>
  <body>
   <script type="text/javascript">
    $(document).ready(function() {
            $("#container").oembed("http://www.youtube.com/watch?v=nue4pvzuyOo");

    });
  </script>
 <div id="container"></div>
 </body>
 </html>

플러그인의 JavaScript를 찾을 수 있습니다 여기.

흥미롭게 도이 오류는 IE8에서는 발생하지 않습니다. IE7 만 있습니다.

이 오류를 일으킬 수있는 것에 대한 아이디어가 있습니까?

도움이 되었습니까?

해결책

jslint 다른 문제들 중에서도 링크 된 플러그인 코드에는 객체 문자 그대로의 추가 쉼표가 있다고보고합니다. 이것을 수정하면 IE7에서 고정되는 것 같습니다.

수정 :

// Plugin defaults
$.fn.oembed.defaults = {
    maxWidth: null,
    maxHeight: null,
            embedMethod: "replace", // "auto", "append", "fill"
};

변경 사항 :

// Plugin defaults
$.fn.oembed.defaults = {
    maxWidth: null,
    maxHeight: null,
            embedMethod: "replace" // "auto", "append", "fill"
};

후에 쉼표를 기록하십시오 "replace".

작업 데모 : http://jsbin.com/oxitu

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top