How to open a new URL with javascript and without cache? - Stack Overflow

I want to load a "new" url and force a refresh on that.If I do something like this:window.op

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?

Share Improve this question edited Oct 21, 2015 at 9:31 user3783327 asked Oct 19, 2015 at 14:06 user3783327user3783327 6269 gold badges30 silver badges62 bronze badges 2
  • 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
Add a ment  | 

2 Answers 2

Reset to default 4

in 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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信