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

Hard refreshing a page with Javascript - Stack Overflow

programmeradmin0浏览0评论

I have a question, I'm opening a pop-up window using javascript then a window pops-up, there I make changes to the css file, when I click on close the following javascript is being used to refresh the window opener page

window.opener.location.reload();
window.close();

But the css remains cached in the browser, after the next refresh this only disappears. Is there a way I can hard refresh the opener page using javascript?

I have a question, I'm opening a pop-up window using javascript then a window pops-up, there I make changes to the css file, when I click on close the following javascript is being used to refresh the window opener page

window.opener.location.reload();
window.close();

But the css remains cached in the browser, after the next refresh this only disappears. Is there a way I can hard refresh the opener page using javascript?

Share Improve this question asked Nov 5, 2009 at 9:56 ElitmiarElitmiar 37k77 gold badges182 silver badges233 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 5

Documentation is great: MDC - window.location

reload(forceget)

Reload the document from the current URL. forceget is a boolean, which, when it is true, >causes the page to always be reloaded from the server. If it is false or not specified, the >browser may reload the page from its cache.

Try adding a parameter to the CSS file URL:

mystyles.css?12345

Most browsers do a plete reload of URLs with parameters.

But make sure, you remove that, when your site goes into production mode!

Try the following:

window.opener.location.href=window.opener.location;
window.close();
发布评论

评论列表(0)

  1. 暂无评论