如何在主窗口中加载URL内容

时间:2015-09-30 14:40:14

标签: javascript jquery

我使用下面的代码在iFrame中加载一些内容。

<html>
<head></head>
<body>
    <div style="position: absolute; overflow: hidden; left: 0px; top: 0px;  width:550px; height:280px;" onClick=onStopRecording();>
        <div style="overflow: hidden; margin-top: -100px; margin-left: -25px;"></div>
        <iframe id="exIframe" src="http://example.com" scrolling="no" frameborder="0"  style="height: 280px; border: 0px none; width: 550px; margin-top: -60px; margin-left: -24px;"></iframe>
    </div>
    </div>
</body>
</html>

现在当我点击iFrame中的网址时,它需要重定向到该网址并在主窗口中加载。

但它正在iFrame中加载。

请注意,我在iFrame中使用第三方网站,我无权修改代码

你能帮忙吗?

提前致谢。

1 个答案:

答案 0 :(得分:3)

你需要这样做:

window.top.location.href = "http://www.google.com"; 
相关问题