代码2: $(-6ren">
gpt4 book ai didi

javascript - jsp中可以更改referer吗?或者如何更改referer?

转载 作者:行者123 更新时间:2023-12-01 05:30:46 25 4
gpt4 key购买 nike

  1. 我想要做的是为每个链接设置不同的引用:

The Links

2.下面的解释是我的尝试:

代码1:

<a class="mymovie"
mytitle="<s:property value="movieLink"/>"
title="<s:property value="movieDownloadPath"/>"
href="javascript:void(0)">
<s:property value="movieName"/>
</a>

代码2:

$(".mymovie").click(function(){
$.ajax({
type:"get",
url:$(this).attr("title"),
beforeSend: function(request) {
request.setRequestHeader("Referer", $(this).attr("mytitle"));
},
});
alert($(this).attr("title"))
});
  • 效果
  • chorm,jquery-2.1.4.min.js:4 Refused to set unsafe header "Referer",jquery-2.1.4.min.js:4 XMLHttpRequest cannot load “This is a FTP link to download movie(like:ftp:/.....rmvb)” Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

    the effect in chorm

    在Firefox中,当我点击一个链接时,没有任何效果。有什么想法吗?

    最佳答案

    通常,不允许更改 referer header 。 There seems to be a workaround ,不过:

    delete window.document.referrer;
    window.document.__defineGetter__('referrer', function () {
    return "yoururl.com";
    });

    关于javascript - jsp中可以更改referer吗?或者如何更改referer?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37467070/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com