http headers - Remove referer from Javascript redirect - Stack Overflow

I need to do a Javascript based redirectwindow.location.href = 'URL';But I need to remove the

I need to do a Javascript based redirect

window.location.href = 'URL';

But I need to remove the referrer from the HTTP headers upon redirection (the target page should see no referrer), how can I do that?

I need to do a Javascript based redirect

window.location.href = 'URL';

But I need to remove the referrer from the HTTP headers upon redirection (the target page should see no referrer), how can I do that?

Share Improve this question asked May 7, 2013 at 9:52 FlavienFlavien 8,19712 gold badges50 silver badges56 bronze badges 1
  • Here is a simple trick using iframes and https: stackoverflow./a/30304058/2440 – Sire Commented May 18, 2015 at 13:19
Add a ment  | 

5 Answers 5

Reset to default 5

<a href="redirecturl" rel="noreferrer" id="autoclick">Link</a>
<script>document.getElementById('autoclick').click();</script>

There is but as far as I know it's not beautiful. Check the first answer here

If you only going to do this for location redirect, then you can set up a bridge page hosted somewhere less sensitive and doesn't do anything other than redirect. Now you can link all the destination to http://<redirect_page>?<actual_url>

window.location.href= window.location.href.split("?")[1];

I know that this question has been inactive for a while, found it browsing the web and found a nice answer that may help save another person's time. This version uses JQuery.

$(function(){

  $("#button").on("click", function(){
      $("head").append('<meta name="referrer" content="no-referrer"/>');
      window.location = "http://www.example";
  });
});
<script src="https://ajax.googleapis./ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<button id="button">Click to navigate</button>

You can't. It's up to the browser to set referrer headers or not, the script has no influence on it.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743735213a4498132.html

相关推荐

  • http headers - Remove referer from Javascript redirect - Stack Overflow

    I need to do a Javascript based redirectwindow.location.href = 'URL';But I need to remove the

    6天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信