我目前遇到的错误只发生在当前版本的Safari(5.1.5)中,并且想知道这里是否有人可以为它提出任何变通方法。我在5.1.2中进行了测试,它在那里运行良好,我不确定5.1.3和5.1.4,因为我无法访问这些版本。
该错误需要三页,我将展示它们的来源,然后解释发生了什么:
FirstPageWithForm.htm
<form id="theForm" action="ActionHandler.ashx" method="post">
<input type="hidden" name="differentField" value="1234"/>
<input type="hidden" name="sameField" value="1111"/>
</form>
<script type="text/javascript">
var theForm = document.getElementById("theForm");
theForm.submit();
</script>
SecondPageWithForm.htm
<form id="theForm" action="ActionHandler.ashx" method="post">
<input type="hidden" name="differentField" value="5678"/>
<input type="hidden" name="sameField" value="1111"/>
</form>
<script type="text/javascript">
var theForm = document.getElementById("theForm");
theForm.submit();
</script>
ActionHandler.ashx
public void ProcessRequest(HttpContext context)
{
var referrer = context.Request.UrlReferrer;
var differentField = context.Request["differentField"];
context.Response.Write(differentField);
if (differentField == "1234")
{
if (referrer.ToString().Contains("Second"))
context.Response.Write("Failure");
else
{
context.Response.Redirect("SecondPageWithForm.htm");
}
}
else
context.Response.Write("Success");
}
您注意到两个表单具有相同的字段名称,但其中一个字段具有不同的值。但是,在运行此代码的Safari中,值"1234"
将作为differentField
而不是"5678"
发送。我不相信这个bug与.NET有任何关系,但我没有一种简单的方法来测试另一种语言以确保这一点。
我已经尝试过的事情:
这些方法中的每一个都具有相同的效果,即打印“失败”而不是成功 我将在Safari论坛上提交这个错误(我没有Apple开发人员帐户,目前还没有创建新的帐户),但我希望有人可以帮我找到合适的解决方法这个问题直到他们解决了。
编辑:Safari论坛错误报告:https://discussions.apple.com/thread/3921507
答案 0 :(得分:0)
NicolasIgot在我的safari论坛上找到了解决问题的方法。
我刚刚将autocomplete="off"
添加到第二张表单上的表单标记中,一切都重新开始了。我没有尝试过我真正的问题,但它适用于我的简单测试用例,所以我对它有信心。