I am currently experiencing a bug that only occurs in the current version of Safari (5.1.5) and was wondering if anyone here could come up with any workarounds for it. I tested it in 5.1.2 and it worked fine there, I m not sure about 5.1.3 and 5.1.4 as I don t have access to those releases.
bug需要三页,我用三页显示这些文件的来源,然后解释正在做些什么:
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");
}
你注意到这两种表格都有相同的外地名称,但其中一个领域具有不同的价值。 然而,在操作该代码时,该数值为<代码>1234”,以<代码>不同>的外地/代码取代<代码>5678”。 我不认为这一丑闻有任何意义。 NET,但我没有容易地测试另一种语言,以确保这一点。
Things I already tried:
- Putting the form submission code in a function and then calling that.
- Requiring Jquery and calling it in the $(document).ready() function.
- Putting the function call in a setTimeout().
- Replacing the function with a button that I press.
- Copying the Handler and sending the second form to the copy instead.
Every single one of these methods had the same effect, which is to print "Failure" instead of Success.
I will be filing this bug on the Safari forums (I don t have an Apple Developer account and it s not working to create a new one at the moment), but I was hoping that someone could help me come up with a suitable workaround for this problem until they fix it.