【发布时间】:2016-02-01 23:00:15
【问题描述】:
当我使用 lumextech.com 搜索并移动到其他网页时,我正在使用 iframe 将 lumextech.com 作为默认 src 在框架中加载但仍然在 iframe src 它的显示 lumextech.com 只有我想要捕获已在 iframe... 中加载的页面的 url。注意:我在 lumextech.com 上没有控制权...。
我的代码:
<! DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery.min.js"></script>
</head>
<body>
<section>
<h3> welcome to Iframe</h3>
<script type="text/javascript">
$(function(){
$('#submit').click(function(){
$url = $('#iframeContent').attr('src');
$('#demo').html($url);
});
});
</script>
<input type="submit" id="submit" value="showUrl"/>
<div id="demo"></div>
<iframe id="iframeContent" src="http://lumextech.com" style="min-height: 500px; min-width: 500px;"></iframe>
</section>
</body>
</html>
【问题讨论】:
-
同源策略限制阻止了对 iframe 的此类访问
-
应该有办法........!!!!!!!!!
标签: javascript jquery