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条)

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b