如何通过使用IE的Java脚本,下面的代码是工作在Mozilla,但无法在Internet Explorer刷新页面如何刷新页面,在IE
- window.location.reload());
- history.go(0);
如何通过使用IE的Java脚本,下面的代码是工作在Mozilla,但无法在Internet Explorer刷新页面如何刷新页面,在IE
Window.location.href是窗口页面的网址。你做什么,只是重写非常相同的值,所以浏览器发送另一个GET请求,同样的乌尔
window.location.href = window.location.href;
可能会添加一些解释至于发生了什么 – 2012-08-03 05:04:58
Window.location.href是窗口页面的网址。你所做的只是重写相同的值,所以浏览器发送另一个GET请求到同一个url。 – 2012-08-03 05:06:55
window.location = window.location
使用window.location.reload(true);
使用本:
location.reload();
它应该工作。如果它不起作用,您的页面中可能会出现其他错误。
在javascript中您可以使用:
location.reload(); => post request, same as click the refresh button on the browser
window.location=window.location; => get request
self.location=self.location; => get request
如果你得到一个IE错误说
“要再次显示该网页时,Internet Explorer需要重新发送您先前提交的信息”,
你可以使用window.location = window.location;刷新页面而不是location.reload();
实现:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="PostMethod_Test._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Literal ID="litJavascript" runat="server"></asp:Literal>
<div>
Refresh:
<div>
Get/Post Method:<a href="javascript:location.reload();">JS Location Reload</a> (if
there is any control in the form then after the form was submitted for the first
time, if you click this, it will be a post method coming with the IE alert)
</div>
<div>
Get Method:<a href="javascript:window.location=window.location;">JS Window Location</a>
(does not create a history entry) (if there is any control in the form then after
the form was submitted for the first time, if you click this, it will still be a
get method which means the form will not be submitted again)
</div>
<div>
Get Method:<a href="javascript:self.location=self.location;">JS Self Location</a>
(Same as above)
</div>
<div>
Get/Post Method: IE Refresh button - same as location.reload()
</div>
</div>
<hr />
<div>
Open New Window:
<div>
No Method:<a href="javascript:var a = window.open('webform1.aspx');">JS Window Open</a>
(just open)
</div>
<div>
Post Method for parent page:<asp:Button ID="btnOpen" Text="Open Window" runat="server" />
</div>
</div>
</div>
</form>
</body>
</html>
你得到任何工作的答案吗? ..尝试所有下面的答案,但没有工作。 – NMathur 2017-09-23 09:07:58