【发布时间】:2013-11-28 15:23:34
【问题描述】:
我正在使用此代码从弹出窗口中的字段中获取值。
http://myotherwebsitename.com/parent.html
<input type="text" id="output"/>
<button id="show">Open</button>
<script>
document.getElementById('show').addEventListener('click', function(){
window['output'] = document.getElementById('output');
window.open('http://mywebsite.com/map.html')
});
</script>
<input type="text" id="user_text"/>
<input id="send" type='button' value'send'/>
<script>
document.getElementById('send').addEventListener('click', function(){
window.opener['output'].value = document.getElementById('user_text').value;
})
</script>
如果两者都托管在同一个网站上,效果很好,但如果我将其中一个放在其他网站上,它就不起作用了。
如何让它适用于不同的网站?
谢谢!
【问题讨论】:
-
你不能。同源政策禁止您访问其他网站的内容。
标签: javascript jquery html jquery-ui