【发布时间】:2010-10-31 08:00:50
【问题描述】:
对于横幅管理系统,我使用
header("Location: http://www.awebsite.com");
重定向到正确的网站。是否可以强制此头脚本在新窗口中打开?
【问题讨论】:
对于横幅管理系统,我使用
header("Location: http://www.awebsite.com");
重定向到正确的网站。是否可以强制此头脚本在新窗口中打开?
【问题讨论】:
<a href='yourbannerscript.php' target='_blank'>...</a>
【讨论】:
header() 函数,这是不可能的:stackoverflow.com/questions/12539011/header-location-in-new-tab
没有。如果你想要一个新窗口,你必须以 HTML/Javascript 的形式提供重定向。
【讨论】:
这对我有用
echo "<script>window.open('yoursite.com');</script>";
【讨论】:
这会很讨厌,并且可能不是您想要的,但是包含一个指向带有标头重定向的 php 文件的 IFRAME 标记可能是一种解决方案。不创建新窗口,而是创建一个窗口中的窗口。
<iframe src="/myredirectscript.php"></iframe>
【讨论】:
您应该重定向到带有重定向元标记的页面,例如Open HTML meta redirect in new window 投票最多的答案中的那个标签
因此,您将标题重定向到的页面将包含一个 meta 标签:
<meta http-equiv="refresh" />
<meta content="0; URL=javascript:window.open('http://uri.of
.your.pagewhereyouwabtoredirect/path','_parent');"/>
【讨论】: