Questions tagged [html5-history]

The HTML5 History API allows programmatic manipulation of the browser's history through JavaScript, providing a method of managing the user's history stack when creating web applications.

The HTML5 History API allows programmatic manipulation of the browser's history through JavaScript, allowing interaction with the browser's history as though it is the user.

Useful documentation:

585 questions
10
votes
4 answers

Clear html history created by pushState on refresh

I have array of states and index of the array in history.state and on popstate I read the content of the array, it work fine but when I go back to first page and refresh the array is gone (which is normal) but forward history state remain. Is it…
jcubic
  • 51,975
  • 42
  • 183
  • 323
10
votes
3 answers

Set URL parameters without causing page refresh

How can you set URL parameters using History.pushState() to avoid browser refreshes? If there is a not a simple JS solution, is there already a popular library or built in function for jQuery? Here is a relevant SO question, where the accepted…
Don P
  • 49,839
  • 95
  • 259
  • 394
9
votes
2 answers

Angular2 pathLocationStrategy: url change cause page reload

While using HashLocationStrategy I can change route by changing address in browser's address bar by hand without page reload. I.e. navigation from mysite/#/home to mysite/#/profile However, if I use PathLocationStrategy (it is default location…
9
votes
2 answers

Is there a way to tell what direction the state is going with history.js?

Like the title says, I'd like to be able to perform a different onstatechange event if the pushState function is called, instead of the back function. Or, if the go function is negative or positive. Example: if History.pushState() or History.go(1)…
Ascherer
  • 7,864
  • 3
  • 39
  • 60
8
votes
1 answer

Broken history for a self-updating form using post-redirect-get

I have a URL /books, which lists some books, and a URL pattern /books/{some-book-title} which shows a view/update form for the metadata of a book. Here's a typical user story, where a user corrects an incorrect author entry: GET /books
Ned Twigg
  • 2,009
  • 2
  • 19
  • 37
8
votes
1 answer

How do I use window.history in JavaScript?

I found a lot of questions about this on Stack Overflow, but they were all very specific about certain parts. I did find this question whose answers provide some nice references, but they don't actually explain how it all works, and their examples…
Yay295
  • 1,303
  • 1
  • 13
  • 24
8
votes
1 answer

Does Ember routing fall back to using a hash if browser doesn't support the History API?

Ember documentation states that it can be set to use the History API for routing rather than hash-based fragments by using: App.Router.reopen({ location: 'history' }); But I can find no mention of what will happen if a browser doesn't support the…
Undistraction
  • 38,727
  • 46
  • 165
  • 296
7
votes
2 answers

HTML5 History API: surviving to a a clear history?

The History API makes it possible to store a state object in the browser history. Now try this demo (but it's the same behavior with any other else, pick your favorite :)): Click on some links to build some history Clear your browser history (full,…
Jocelyn LECOMTE
  • 830
  • 1
  • 7
  • 15
7
votes
2 answers

React Router: Query Param Match?

According to the accepted answer to this question, React Router 4 doesn't match query parameters anymore. If I go from a URL matched by one of my s to the same URL with a different query string, the content doesn't seem to change. I believe…
trysis
  • 7,124
  • 12
  • 47
  • 74
7
votes
1 answer

Reload page on browser back/forward button in AngularJS with ui router

I have the following config for ui router state in my angularjs app. $locationProvider.html5Mode(true); $stateProvider .state('index', { url: '/index?zoom¢er', views: { 'map': { …
kdu
  • 1,179
  • 1
  • 11
  • 18
7
votes
1 answer

statechange load is causing multiple loads of the same page

It appears that this line in the statechange event: $('#content').load(State.data.home_page); ...is causing the same page to load multiple times which is resulting in glitches on my site. What can I do to fix this? (function($) { function…
J82
  • 7,605
  • 21
  • 48
  • 79
7
votes
2 answers

How to enable/disable "click to go forward" button in browser using history js?

Using history.pushState, we can change the current url using history API. Using popstate function, we can get back to previous page. But while going back, I found that the forward link button in browser "Click here to go forward" gets disabled. Now,…
Ganesh Babu
  • 3,250
  • 8
  • 31
  • 60
7
votes
0 answers

Javascript history state incorrect

I am trying to populate the index of the currently selected tab using history.pushState({tabSelected: 1}, null, ""); I have a handler to the popstate event in jquery which programmatically switches the jquery ui tabs. $(window).bind("popstate",…
Rohit Banga
  • 16,996
  • 26
  • 101
  • 179
6
votes
5 answers

Hashtags (Fragment identifiers) VS Javascript History API

Which one is better? Using fragment identifiers... http://www.alinkthatdoesnotwork.com/#!/dir1/dir2/file.html ...or the new Javascript History API? https://github.com/examplethatdoesnotwork/project/src/script.js Or should I use both? (via…
auroranil
  • 2,371
  • 6
  • 20
  • 34
6
votes
1 answer

history.replaceState not working for firefox v56+

In my application, To Hide some information in URL i am using below code. history.replaceState ({}, "", "bar.html"); It is working in all the browsers except firefox latest version (v56+) In Firefox, if i press F5 then it is going back to previous…
Jayesh Dhandha
  • 1,465
  • 18
  • 37
1 2
3
38 39