最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin2浏览0评论

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

发布评论

评论列表(0)

  1. 暂无评论