Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个在 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/');
他们不适合我。
尝试这个:
<script type="text/javascript"> if (top.location!= self.location) { top.location = 'http://www.newsite.com/'; } </script>
如果它在 iframe 中运行,它会将父窗口重定向到http://www.newsite.com/.
http://www.newsite.com/