【发布时间】:2015-12-18 07:12:19
【问题描述】:
我正在使用 Youtube API (https://developers.google.com/youtube/v3/?hl=en),特别是:播放列表、播放列表项和要加载的频道。
这适用于所有浏览器,例如 IE9 及更低版本。在这里我总是收到"No Transport" 错误。
这是一个简单的示例代码:
<!Doctype html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Youtube API Test</title>
</head>
<body>
<code>
</code>
<script src="Scripts/jquery-2.1.4.js"></script>
<script>
$.ajax({
cache: false,
type: 'GET',
crossDomain: true,
url: 'https://www.googleapis.com/youtube/v3/playlistItems',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (data) {
$('code').text(JSON.stringify(data, null, 4));
},
error: function (err) {
$('code').text(JSON.stringify(err, null, 4));
}
});
</script>
</body>
</html>
(注意我删除了参数,在 Chrome 和 FF 中这会返回一个 youtube 错误,在 IE 中是一个“No Transport”错误)。
我尝试使用 xdomain 插件 (https://github.com/jpillora/xdomain)
和XDomainRequest 插件 (https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest#instructions)
建议here,但没有成功。我缺少什么,这对其他人有用吗?
【问题讨论】:
标签: jquery youtube-api internet-explorer-8 internet-explorer-9