html5-history

Safari send POST request when refresh after pushState/replaceState

别说谁变了你拦得住时间么 提交于 2021-02-19 04:08:01
问题 After post a form, I use pushState/replaceState to manipulate the history. Then when refresh, Chrome will send GET request to the new url, but Safari will send POST. Is it a BUG in Safafi? Anyone had met it before? 来源: https://stackoverflow.com/questions/46933389/safari-send-post-request-when-refresh-after-pushstate-replacestate

Safari send POST request when refresh after pushState/replaceState

旧时模样 提交于 2021-02-19 04:07:52
问题 After post a form, I use pushState/replaceState to manipulate the history. Then when refresh, Chrome will send GET request to the new url, but Safari will send POST. Is it a BUG in Safafi? Anyone had met it before? 来源: https://stackoverflow.com/questions/46933389/safari-send-post-request-when-refresh-after-pushstate-replacestate

How to know if react-router can go back to display back button in react app

非 Y 不嫁゛ 提交于 2020-11-30 10:56:32
问题 There seems to be no API way to detect if you can go back from the current page in an app. One can check the history length, but that includes the forward and backward stack. I want to display the back button only when the user actually can go back. 回答1: I think I found a workaround There is onpopstate event: Calling history.pushState() or history.replaceState() won't trigger a popstate event. The popstate event is only triggered by performing a browser action , such as clicking on the back

How to know if react-router can go back to display back button in react app

三世轮回 提交于 2020-11-30 10:56:20
问题 There seems to be no API way to detect if you can go back from the current page in an app. One can check the history length, but that includes the forward and backward stack. I want to display the back button only when the user actually can go back. 回答1: I think I found a workaround There is onpopstate event: Calling history.pushState() or history.replaceState() won't trigger a popstate event. The popstate event is only triggered by performing a browser action , such as clicking on the back

Access React Router history stack

爷,独闯天下 提交于 2020-06-28 04:48:13
问题 I have an application where you arrive at a photo album listing via various means (searching, drill down by category, etc). From the album, you click open individual photos and iterate through them using left/right arrows, as well as various editing tools. Each of the iterate/tool actions does a history.push() to add the route to the router history. I am trying to implement a button that will go back to the exact place in the history before you started viewing individual photos. To do that, I

HTML5 History API: “popstate” not called when navigating back from another page

与世无争的帅哥 提交于 2020-06-27 16:39:35
问题 I have to maintain a site with an AJAX search form (for lets say books) and I want the search results to be a part of the browser history. So I set the "popstate" event handler window.addEventListener('popstate', function(e) { alert("popstate: " + JSON.stringify(e.state)); }); and call pushState() upon the successfull AJAX request: var stateObj = { q: "harry potter" }; window.history.pushState(stateObj, "Result", "/search"); Then my clickflow is: Load the page with the search form - NORMAL

BrowserRouter vs Router with history.push()

半城伤御伤魂 提交于 2020-06-09 16:46:00
问题 I am trying to understand the difference between BrowserRouter and Router of the react-router-dom (v5) package and what difference it makes for my example below. The documentation says: BrowserRouter A that uses the HTML5 history API (pushState, replaceState and the popstate event) to keep your UI in sync with the URL. Source: https://reacttraining.com/react-router/web/api/BrowserRouter Router The common low-level interface for all router components. Typically apps will use one of the high