0
<script src="http://connect.soundcloud.com/sdk.js"></script>
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script>
// initialize client with app credentials
SC.initialize({
client_id: 'bea6b4a2c1108a4cfa99f0d40966108a',
redirect_uri: 'http://www.samplewars.com/'
});
// initiate auth popup
SC.connect(function() {
SC.get('/me', function(me) {
alert('Hello, ' + me.username);
});
});
</script>
Unsafe JavaScript attempt to access frame with URL http://samplewars.com/soundcloud/ from frame with URL http://www.samplewars.com/soundcloud/?code=77c9dc160d723a52f67d42a89067848e&state=SoundCloud_Dialog_80886#access_token=1-26934-195352-78151464de9a2ec39&scope=non-expiring. Domains, protocols and ports must match.
我得到我的鉻控制檯這個錯誤,並在FF它只是不斷通過允許過程中沒有拍攝出來的警報循環。的SoundCloud認證/連接JavaScript的問題
有趣的是,它工作了一秒鐘,然後我去喝一杯,回來了,它被打破了。
編輯:它也停留在彈出窗口內,而不是關閉回原始窗口 編輯2:它也實際上在應用程序的連接菜單中增加了soundcloud內部的權限。只是不吐出警報。
編輯3:好吧,它現在在FF中工作後,我添加了一個onclick事件,以阻止它不斷循環js。所以現在的代碼是:
<script src="http://connect.soundcloud.com/sdk.js"></script>
<script>
// initialize client with app credentials
SC.initialize({
client_id: 'bea6b4a2c1108a4cfa99f0d40966108a',
redirect_uri: 'http://www.samplewars.com/'
});
// initiate auth popup
function connectSC(){
SC.connect(function() {
SC.get('/me', function(me) {
alert('Hello, ' + me.username);
});
});
}
</script>
<div id="connect_button" onClick="connectSC()">
connect to soundcloud
</div>
它在FF中工作,但不在Chrome或IE中。