JS表单提交"该页面无法使用Chrome Data Saver加载.尝试重新加载页面.调试信息:POST CISmtuKa5MwCFUIEYgodMxIGmQ ==& quot; [英] JS form submit "This page cannot be loaded using Chrome Data Saver. Try reloading the page. Debug info: POST CISmtuKa5MwCFUIEYgodMxIGmQ=="

查看:63
本文介绍了JS表单提交"该页面无法使用Chrome Data Saver加载.尝试重新加载页面.调试信息:POST CISmtuKa5MwCFUIEYgodMxIGmQ ==& quot;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个简单的页面上有一个表格.提交时,它将名字,姓氏,电子邮件"的数据传递到我的客户的真实"加入表单,并使用户能够继续用数据填写表单.

I have a form on a simple page. When submitting it passes data of the "first name, last name, email" to the "real" join form of my customer and enables the user to continue to fill in the form with the data.

当我的客户在某些android手机上运行它时,会出现以下错误:

When my customer is running it on some android mobile phones he get this error:

无法使用Chrome Data Saver加载此页面.尝试重新加载页.

This page cannot be loaded using Chrome Data Saver. Try reloading the page.

调试信息:POST CISmtuKa5MwCFUIEYgodMxIGmQ ==

Debug info: POST CISmtuKa5MwCFUIEYgodMxIGmQ==

在我测试过的每部手机上,它都能正常工作.客户在2种不同的手机上对其进行了测试,但他(仅)收到了这些错误.据我测试,这在台式机上不会发生.我也在Android上的一些不同浏览器上对其进行了测试,并且工作正常.

On every mobile phone I tested it - it works fine. The customer tested it on 2 different mobile phones and he (only) got these errors. This doesn't happen on desktops as far as I tested it. I tested it on some different browsers on my android too and it works fine.

这是我的表格:

<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()是一个有趣的函数.我只是粘贴了所有代码,以防万一=]:

And this is the JS code. The last function chgAction() is the one that needs to be interesting. I just pasted all the code, just incase =] :

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后面吗?

I'm the tech lead on the Chrome Data Saver team. This will occur if the user has the Data Saver feature enabled in Chrome (either desktop or mobile) and our proxy can't talk to the backend server that you are doing the POST to. Is this because the server is behind an intranet?

短期解决方法是要求人们关闭Data Saver,但这并不理想-我们首先应该能够避免这对您造成问题.您可以在网站上提供的任何详细信息都会有所帮助.如果您想直接发送电子邮件,我是mdw点la的mdw.谢谢.

The short-term workaround is to ask people to turn off Data Saver, but that is not ideal -- we should be able to avoid this being a problem for you in the first place. Any details you can provide on the site would be helpful. If you prefer to email directly I am mdw at mdw dot la. Thanks.

这篇关于JS表单提交&quot;该页面无法使用Chrome Data Saver加载.尝试重新加载页面.调试信息:POST CISmtuKa5MwCFUIEYgodMxIGmQ ==&amp; quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆