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

报告相同问题?

悬赏问题

  • ¥15 plotBAPC画图出错
  • ¥30 关于#opencv#的问题:使用大疆无人机拍摄水稻田间图像,拼接成tif图片,用什么方法可以识别并框选出水稻作物行
  • ¥15 Python卡尔曼滤波融合
  • ¥20 iOS绕地区网络检测
  • ¥15 python验证码滑块图像识别
  • ¥15 根据背景及设计要求撰写设计报告
  • ¥20 能提供一下思路或者代码吗
  • ¥15 用twincat控制!
  • ¥15 请问一下这个运行结果是怎么来的
  • ¥15 单通道放大电路的工作原理