码迷,mamicode.com
首页 > 其他好文 > 详细

跨域访问

时间:2014-08-19 00:55:43      阅读:294      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   java   os   io   ar   

 

iframe方式嵌入页面的操作实验

 

实验

<html>
<body>
<h1>
hi, this is a.html, frame below show b.html
</h1>
<iframe src="http://localhost/b.html"></iframe>
<script type="text/javascript">
        window.onload = function(){
                console.log("a.html loaded");
                var frame = document.getElementsByTagName("iframe");
                console.log("frame src="+frame[0].src);
                var binput = frame[0].contentDocument.getElementById("binput");
                console.log("b.html binput value="+binput.value);
        }

</script>
</body>
</html>
<html>
<body>
<h1>
hi, this is b.html. this page call by localhost domain.
</h1>
<input id="binput" value="binput"/>
</body>
</html>

 

跨域访问,布布扣,bubuko.com

跨域访问

标签:style   blog   http   color   java   os   io   ar   

原文地址:http://www.cnblogs.com/lightsong/p/3920935.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!