【发布时间】:2012-11-06 22:05:48
【问题描述】:
我正在尝试从这个小 API 调用 SC.Widget 函数:http://developers.soundcloud.com/docs/api/html5-widget,但我在 Chrome 检查器中收到此错误消息并且我卡在那里。
不安全的 JavaScript 尝试使用 URL 访问框架
file://localhost/Users/maxwell/Desktop/test/test.html来自带有 URL 的框架
http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F67825032&auto_play=false&show_artwork=true&color=ff7700.请求访问的帧具有“http”协议,该帧是 访问具有“文件”协议。协议必须匹配。
<body>
<iframe id="soundcloud" width="100%" height="166" scrolling="no" frameborder="no"
src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F67825032&auto_play=false&show_artwork=true&color=ff7700"></iframe>
<script>
Soundcloud();
</script>
</body>
function Soundcloud() {
var widget1 = SC.Widget(iframeElement.soundcloud);
alert("widget1");
}
我知道这样做是出于安全原因,但如果我无法访问框架,我该如何修改 SoundCloud 小部件?
感谢您的帮助!
【问题讨论】:
标签: javascript soundcloud