Answer the question
In order to leave comments, you need to log in
How to reload the page bypassing pushState?
Good afternoon!
There is a legacy portal code, front: html, js (well, jquery), back: asp core. Separate sections are made as spa, without any frameworks, just ajax, but index pages are made by razor. History support was not initially included, but all actions on the page adequately form a url, which, if copied and pasted into the browser line, will adequately display the page. If you press the back and forth buttons in the browser, the url changes, but the page does not reload.
There is a task to implement history support in sections. And the problem is that the page is loaded, formed on the server by a split, and then, when working with the page, individual blocks are loaded by Ajax. Those. or should I completely rewrite how the page is initially rendered (make it a controller, make an Ajax request, form a page on the client based on the data received, which can also have 3-4 blocks for different requests, etc., in general, almost from scratch write a view with all js logic, or look for another solution :)
All window.location methods do pushState (well, except for getting the url itself)), so I can’t reload the page using it, it spoils the history. I tried to get the entire page index with Ajax, cut out the body from it and stupidly insert it into the body of the current page. I get artifacts in the form of unloaded / unfinished js scripts in some blocks that are in the index as partial views.
In general, the question is, how can you do something like window.location = url, only without the fact that it will go down in history?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question