[英]Yii Framework PHP redirect to external Link in new tab?
嗨,我本质上想要实现的是现在我已经有了一个重定向到新标签中的外部链接的功能:
$this->redirect('http://www.google.com', array('target'=>'_blank'));
哪个重定向但不在新标签中...
您无法在这样的新标签页中重定向,因为无法在Location http标头中指定目标。
可能的解决方法是输出表单并立即使用JS提交:
<form action="http://www.google.com" method="get" target="_blank" id="myform"></form>
<script>
document.getElementById("myform").submit();
</script>
请注意,您将需要以某种方式将其隐藏在当前标签中的主要内容中。
嘿,看看这可能对您有帮助
<?php echo CHtml::link('Link Text','http://google.com', array('target'=>'_blank')); ?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.