【发布时间】:2012-03-08 04:57:17
【问题描述】:
我正在尝试在此处的示例之后为我的代码建模:http://connect.soundcloud.com/examples/connecting.html#
它适用于 Firefox,但不适用于 chrome。在 chrome 中,soundcloud 弹出窗口正确显示,我可以登录(返回 sc-connect.html),但随后窗口不会关闭。仔细检查后,由于 window.opener 为空,因此存在 javascript 错误。我想知道它是否与localhost uri有关?上面链接中的示例适用于 Firefox 和 chrome。有任何想法吗?我的代码如下:
SC.initialize({client_id:'my_client_id', redirect_uri:'http://localhost:3000/sc-connect.html'});
$('button').click(function(){
SC.connect(function () {
console.log('made it');
}
}
我的 sc-connect.html 页面如下所示:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Connect with SoundCloud</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body onload="window.opener.setTimeout(window.opener.SC.connectCallback, 1)">
<b style="width: 100%; text-align: center;">This popup should automatically close in a few seconds</b>
</body>
</html>
此应用在 soundcloud 上的重定向 URI:http://localhost:3000/sc-connect.html
【问题讨论】:
-
好的,所以经过更多测试后,上面的代码(在修复缺少的括号后)在 firefox、safari 和 chromium 中有效,但在 chrome 中无效(即使在没有扩展的 icognito 中)......不是确定有什么不同,特别是。在铬和铬之间
标签: soundcloud