I want to load a "new" url and force a refresh on that. If I do something like this:
window.open(url,"_self");
location.reload(true);
Then the the old URL will be reloaded. If I just use "open" the cache is used.
The URL from server is the same. For example:
currentURL = "index.html#/TheOldURL";
window.open("index.html#/TheNewURL","_self");
location.reload(true);
The code would do a reload of index.html#/TheOldURL
.
Is there any way to force a reload of the page but with the new URL?
I want to load a "new" url and force a refresh on that. If I do something like this:
window.open(url,"_self");
location.reload(true);
Then the the old URL will be reloaded. If I just use "open" the cache is used.
The URL from server is the same. For example:
currentURL = "index.html#/TheOldURL";
window.open("index.html#/TheNewURL","_self");
location.reload(true);
The code would do a reload of index.html#/TheOldURL
.
Is there any way to force a reload of the page but with the new URL?
- You are going to an anchor of the same page? Then of course it will stay at the same page. – Daniel Cheng Commented Oct 19, 2015 at 14:10
- Yes, but is there a way to force a reload (with the new URL)? – user3783327 Commented Oct 19, 2015 at 14:13
2 Answers
Reset to default 4in order to force a refresh on the url, you have to mark it as a new url. this can be done by adding a unique identifier to the url. using your example:
window.open (url+"?dt="+(new Date()).getTime(),"_self");
You can have a handle on the new window and refresh that.
var childWindow = window.open(/* ... */);
childWindow.location.reload();
refresh child window from parent window
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742333522a4424192.html
评论列表(0条)