【发布时间】:2016-01-06 19:36:12
【问题描述】:
我正在尝试使用任何来源在iframe 中运行一个小型应用程序:
<script>
$.getJSON('http://whateverorigin.org/get?url=' +
encodeURIComponent('http://vend.giftcardservices.nl/saldo/3') +
'&callback=?', function(data){
alert(data.contents);
});
</script>
警报显示 html 已获取,但是当我尝试 document.write(data.contents) 时,什么也没有发生。如何让这段代码在浏览器中执行?
【问题讨论】:
标签: javascript same-origin-policy