dongyan5706 2014-08-27 12:38
浏览 33
已采纳

在_blank中打开PHP标头[重复]

This question already has an answer here:

I use a header location to link another site at my site. Please, don't look after this manner, I can't do anything with it... My code looks like this

if($navigateId==82) {
        header( "HTTP/1.1 301 Moved Permanently" ); 
        header( "Location: http://newsite.com/sample-link" ); 
    }

I would like, if I only can open this anchor at new card (target="_blank") Thanks for help

</div>
  • 写回答

2条回答 默认 最新

  • doufei8691 2014-08-27 12:43
    关注

    The thing is that you are using server-side redirection and the target="_blank" is client-side directive to browser to open the URL in new window (or tab). So I don't think that you can arrange it using server-side coding.

    BTW, I have found already this question answered - Header Location in new tab

    You can arrange needed functionality using jquery. I mean if the link which needs to be checked and opened in new window is not static html content or entered in a WYSIWYG you can check by AJAX call the id server-side and open it in new window if needed. The checkings can be done also client side but you have to supply the javascript code with the ID-s which need to be opened in new window.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 YOLO检测微调结果p为1
  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题