oembed API(json)を介してvimeo埋め込みコードを取得しようとしています。
サファリでは正常に動作しますが、Firefoxでは、(successメソッドで)javascriptオブジェクトの代わりにnull値を取得するため、返されたjsonが正しく解釈されないようです。
jsfiddleの例へのリンクを示しますが、サンプルはそこでは機能しません。許可されていないオリジンに関するエラーがあります。
だからここにコードがあります:
<script type='text/javascript' src='http://code.jquery.com/jquery-1.4.4.min.js'></script>
<script type='text/javascript'>
//<![CDATA[
$(window).load(function(){
$.ajax({
url: "http://vimeo.com/api/oembed.json?&format=json&url=http%3A//vimeo.com/2197639",
dataType: "json",
success: function(data) {
$('#output').html(JSON.stringify(data));
},
error: function(errorSender, errorMsg) {
console.log(errorSender);
console.log(errorMsg);
$('#output').html(errorSender + ' ' + errorMsg);
}
});
});
//]]>
</script>
何が間違っている可能性がありますか?それはjsonとの何かですか?
サンプルのjsonは次のとおりです。
{"type":"video","version":"1.0","provider_name":"Vimeo","provider_url":"http:\/\/vimeo.com\/","title":"Early Morning Qena","author_name":"Oliver Wilkins","author_url":"http:\/\/vimeo.com\/offshoot","is_plus":"1","html":"<iframe src=\"http:\/\/player.vimeo.com\/video\/2197639\" width=\"1280\" height=\"720\" frameborder=\"0\" webkitAllowFullScreen allowFullScreen><\/iframe>","width":1280,"height":720,"duration":229,"description":"Early morning in Quft, near Qena. Shot with EX1 and Letus Extreme 35mm DOF adaptor.\n\nwww.offshoot.tv\n","thumbnail_url":"http:\/\/b.vimeocdn.com\/ts\/271\/854\/27185484_640.jpg","thumbnail_width":640,"thumbnail_height":360,"video_id":2197639}