2

I have a web page working with timespans, and I am updating the startTime and endTime in the url query string continuously to simplify linking the same time range to other users.

The issue however is that any new time updated in the url will add a new entry to the browsers global history; creating 100 entries of basically the same page.

I am able to prevent the history state and "back-button" functionality from going crazy through the html 5 history api, but unable to alter global history.

Is it possible to replace entries in the global history if the base url is the same? Basically: if url prior to "?" is the same, replace previous entry.

I have gone through N pages on google, and some pages on Bing.. closing in to my limit here lads.

Here's a screenshot of the browser history: "Duplicate" entries in global history

Please note that what's blacked out is the same in all entries, and is information I'm not comfortable sharing online.

Edit: This is concerning the browser global history (ctrl + H in chrome). I am aware of window.history.replaceState, but it does not affect the global history. ref MDN docs:

history.replaceState() operates exactly like history.pushState() except that replaceState() modifies the current history entry instead of creating a new one. Note that this doesn't prevent the creation of a new entry in the global browser history.

Furthermore, when I write to the url in our angularjs application I do so with $state.go to current with notify: false and location:replace, but this only works when the url is equal. It does not read the url as equal when the timestamps in the query string is different. $State.go with location:replace

Ronvik
  • 21
  • 2
  • What if you provide a button (or some other clickable element) titled "Share a link to this page" to facilitate linking instead of constantly updating the querystring? – Lex Jun 19 '18 at 13:53
  • Possible duplicate of [Change the URL in the browser without loading the new page using JavaScript](https://stackoverflow.com/questions/136458/change-the-url-in-the-browser-without-loading-the-new-page-using-javascript) – Heretic Monkey Jun 22 '18 at 21:47

0 Answers0