dongtaochan0777 2015-09-06 21:48
浏览 299
已采纳

重定向到新网址,但从历史记录中删除以前的网址

How to replaces the current URL document with a new one but removes the URL of the current document from the document history, meaning that it is not possible to use the "back" button to navigate back to the original document and not store in browser history list.

I can to this by jQuery or javascript by

  window.location.replace("newURL");

but I need to do like this in php.HOW?

  • 写回答

3条回答 默认 最新

  • dongye1912 2015-09-06 22:27
    关注

    If you want no remnants of the page in the browser history at all, then you cannot send the browser there because it will keep track of all visited pages in the history so it can properly show which links have been visited. As best as I know, there is no way to stop the browser from keeping track of the visited links. If you do a 302 location redirect from the server, both original and redirected page will be in the browser history. The original page will not be in the back-button list, but will be in the history.

    If the part of the URL that you are trying to keep less visible is query parameters to the URL, then you can use a form post instead of regular page load because the browser will not store form parameters in the visible part of the history.

    Otherwise, you may need to use your URL with an Ajax call (since that will not be stored in the history) and then use client-side window.location.replace(...) to go to the final URL, the idea being that the URL you don't want to share publicly will have never been an URL that the browser page went to, only a URL that was used for an Ajax call.

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

报告相同问题?

悬赏问题

  • ¥60 pb数据库修改或者求完整pb库存系统,需为pb自带数据库
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路