1

我有一个在 iframe 中工作的网站,我希望它突破 iframe,并重定向到另一个网站,应该打开具有自己 url 的整个新网站,而不是维护当前的 URL 或 iframe。

我努力了

<meta http-equiv="refresh" content="0"; URL="http://www.newsite.com/newurl.html">
and
header ('Location:http://www.newsite.com/');

他们不适合我。

4

1 回答 1

2

尝试这个:

<script type="text/javascript">
    if (top.location!= self.location) {
       top.location = 'http://www.newsite.com/';
    }
</script>

如果它在 iframe 中运行,它会将父窗口重定向到http://www.newsite.com/.

于 2014-09-16T14:31:31.780 回答