我在一个简单的页面上有一个表单。提交时,它将"名字、姓氏、电子邮件"的数据传递给我的客户的"真实"加入表格,并使用户能够继续用数据填写表格。
当我的客户在一些安卓手机上运行它时,他会得到这个错误:
无法使用Chrome数据保护程序加载此页面。尝试重新加载页
调试信息:POST CISmtuKa5MwCFUIEYgodMxIGmQ==
在我测试过的每一部手机上,它都运行良好。客户在两部不同的手机上测试了一下,结果(只)出现了这些错误。就我测试的情况而言,这并没有发生在台式机上。我也在我的android上的一些不同浏览器上测试了它,它运行得很好。
这是我的表格:
<form id="preregistrationForm" action="" onsubmit="return get_action();" method="post">
<div>
<input type="text" name="FirstName" id="FirstName" placeholder="First Name">
</div>
<div>
<input type="text" name="LastName" id="LastName" placeholder="Last Name">
</div>
<div>
<input type="text" name="EMail" maxlength="50" id="EMail" placeholder="Email">
</div>
<input type="hidden" id="maleGengler" class="genderRadio" name="Gendler" value="M" checked="">
<input type="hidden" id="femaleGengler" class="genderRadio" name="Gendler" value="F">
<select name="birthDateMonth" id="birthDateMonth" style="display: none;">
</select>
<select name="birthDateDay" id="birthDateDay" style="display: none;">
</select>
<select name="birthDateYear" id="birthDateYear" style="display: none;">
</select>
<input type="hidden" name="btag" id="btag" value="">
<input type="hidden" name="affid" id="affid" value="">
<button class="join-sub" onclick="chgAction()"></button>
</form>
这是JS代码。最后一个函数chgAction()
需要引起兴趣。我刚刚粘贴了所有的代码,只是以防万一=]:
var Adp = {
getBtag: function() {
// split url and retrieve btag
var aPath = window.location.href.split("?");
var sbtag = aPath[aPath.length - 1];
return sbtag;
},
persistAffiliateData: function() {
// get the affiliate data from the url
var bTag = Adp.getBtag();
if (!bTag) { return false; }
// get all the links on the page
var aLinks = document.getElementsByTagName("a");
if (!aLinks) { return false; }
// add the affiliate data to the links to exampleurl
for (var i = 0; i < aLinks.length; i++) {
if (aLinks[i].href.indexOf("exampleurl") > 0 || aLinks[i].href.indexOf("localhost") > 0) {
aLinks[i].href = aLinks[i].href + "?&" + bTag;
}
}
}
};
function addLoadEvent(func){
// appends unlimited functions to the onload event
var oldonload = window.onload;
if(typeof window.onload != 'function'){
window.onload = func;
}else{
window.onload = function(){
oldonload();
func();
}
}
}
addLoadEvent(Adp.persistAffiliateData);
/*Function used of the pre-signup form of the sites*/
function getQueryStringByName(name) {
name = name.replace(/[[]/, "\[").replace(/[]]/, "\]");
var regex = new RegExp("[\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/+/g, " "));
}
function chgAction()
{
var btag = getQueryStringByName("btag");
var affid = getQueryStringByName("affid");
var isIncomeAccess = "false";
if (btag !="" && affid != "")
{
isIncomeAccess = "true";
$("#btag")[0].value=btag;
$("#affid")[0].value=affid;
}
var feObj=$("#femaleGengler")[0];
if (feObj.checked){
Gendler="F";
}else
{Gendler="M";}
var _action = "//www.exampleurl.com/preregistration?Gendler="+Gendler+"&FirstName="+$("#FirstName")[0].value+"&LastName="+$("#LastName")[0].value+"&EMail="+$("#EMail")[0].value+"&birthDateMonth="+$("#birthDateMonth")[0].value+"&birthDateDay="+$("#birthDateDay")[0].value+"&birthDateYear="+$("#birthDateYear")[0].value;
if(isIncomeAccess=="true")
_action += "&btag="+btag+"&affid="+affid;
document.getElementById("preregistrationForm").action = _action;
document.getElementById("preregistrationForm").submit();
document.getElementById("preregistrationForm").action = _action;
}
我是Chrome Data Saver团队的技术负责人。如果用户在Chrome(台式机或移动设备)中启用了数据保护程序功能,并且我们的代理无法与您进行POST的后端服务器进行通信,则会发生这种情况。这是因为服务器位于intranet后面吗?
短期的解决方法是要求人们关闭Data Saver,但这并不理想——我们应该能够从一开始就避免这成为你的问题。您可以在网站上提供的任何详细信息都将有所帮助。如果你喜欢直接给我发电子邮件,我是mdw dot la的mdw。谢谢。