论坛首页 Web前端技术论坛

Firefox form submit 不能返回上一页

浏览 2646 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2012-03-22   最后修改:2012-03-22
当我用 document.myform.submit() 提交后,来到test2.html页面。尝试返回,但是,在Firefox 5.0不行。连可以返回的状态都没有,如图片红圈处:
但是在IE下,就顺利返回上一页。请问Firefox用FORM submit 提交后,怎么才能有返回上一页的状态?

test1.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function hui() {
	alert("book");
document.myform.submit();
}
</script>
</head>
<body>
<form action="test2.html" method="post" id="myform" name="myform">
<input type="text" value="book">
<a href="#"><span onClick="hui()">Click</span></a>
</form>
</body>
</html>


test2.html
<html>
<head>
</head>
<body>
Test 2 <a href="#" onclick="javascript:window.history.back(); return false;">Back</a>
</body>
</html>
   发表时间:2012-03-22   最后修改:2012-03-22
问题解决,原来自己多手,在http://localhost:8080/project/zh/test1.html, 首次点击进去后,在test2.html页面中点击返回,然后再次点击test1.html. 此时http://localhost:8080/project/zh/test1.html#,已经多了一个“#”号,接着的行为,就会没有返回状态了。直接原因就是下面的红色#号。

因为我在测试时,直接COPYhttp://localhost:8080/project/zh/test1.html#到Firefox中,才造成这样的问题,我想现实用户应该,没多大的概率会如此的。纳闷的是,在IE 和 Chrome中却不会有问题。Firefox为什么会这样?


test2.html
<a href="#" onclick="javascript:window.history.back(); return false;">Back</a>
0 请登录后投票
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics