I have a single page application, and I want to reload, but whenever I run window.location.reload(true);
, it refreshes to the homepage. For example, if I run it from www.mywebsite.com/test/1
, it will open www.mywebsite.com
, I simply want it to refresh to www.mywebsite.com/test/1
, and I want it to happen from server, not from cache. Any ideas how to do it with pure JS?
Try
window.location = 'www.mywebsite.com/test/1'
It will still reload the page, but as long as your JS redraws based on the URL it should work.
IMHO a single page app should never call reload. You just draw and clear elements on the page.
你试过简单的 location.reload() 吗?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.