The HTML5 History API allows a web page to manipulate the contents of the history stack in order to dynamically update the URL and respond to the back button.
Questions tagged [pushstate]
635 questions
17
votes
3 answers
How to handle facebook sharing/like with hashbang urls?
I am building a website where from the homepage i will open some other URI on the website into a lightbox (AJAX), and i want to use HTML5 push state and hash bangs as a fallback to manage changes of states.
Now i want the urls to be crawlable and…

skiplecariboo
- 842
- 2
- 9
- 21
17
votes
5 answers
HTML5 History API - What is the max size the state object can be?
The pushState method accepts a state object. Firefox documents say the maximum size of this object is 640kb. Is it defined in the specs what the smallest maximum size a browser can implement is? Can I reasonably expect major browsers to provide…

Kyle
- 21,377
- 37
- 113
- 200
17
votes
1 answer
Chrome on iOS; back/forward doesn't work with history.pushState?
I have a web page that uses history.pushState with fragment identifiers (i.e. #Heading1) and jQuery's animate method to navigate within the document.
This is how I navigate to a location in the document:
$('nav a').click(function(e){
…

Vince
- 3,962
- 3
- 33
- 58
17
votes
1 answer
How to improve SEO for single page application
We have built a search-engine for vacancies.
For reasons of speed and a good user-experience, we used a the architecture of a “Single Page Application” (SPA).
We know that for a SPA-architecture it is a challenge to enable SEO, so we did quite a…

Maciej Uruski
- 179
- 1
- 1
- 3
17
votes
2 answers
history pushState and scroll position
I am trying to retrieve the scroll position when a user navigates back in the browser history using HTML5 popstate handler.
Here is what I have:
$(document).ready(function () {
$(window).on('popstate', PopStateHandler);
…

George Filippakos
- 16,359
- 15
- 81
- 92
16
votes
1 answer
Moving back to a pushState entry that used ajax
I'm having an issue with the following situation.
User visits site
User clicks link which uses history.pushState to update the url
Partial page content loaded via ajax (using jQuery)
User clicks regular link which loads a new page
User clicks back…

Nick
- 229
- 5
- 12
16
votes
3 answers
How do I throw a real 404 or 301 with an Angular pushstate URL
I'm using $routeProvider and $locationProvider to handle pushstate URLS in a single page app (SPA), something like this:
angular.module('pets', [])
.config(function($routeProvider, $locationProvider) {
$locationProvider.html5Mode(true);
…

superluminary
- 47,086
- 25
- 151
- 148
15
votes
1 answer
history.pushstate fails browser back and forward button
I'm using jQuery to dynamically load content in a div container.
The server side code detects if the request is AJAX or GET.
I want the browsers back/forward buttons to work with the code so I try to use history.pushState. I've got to following…

Barry127
- 1,212
- 1
- 12
- 23
14
votes
1 answer
Account for Backbone.js pushState routes with node.js express server?
pushState support was introduced with Backbone.js' version 0.5 update.
From the backbone documentation:
Note that using real URLs requires your web server to be able to
correctly render those pages, so back-end changes are required as
well. For…

swaggler
- 583
- 2
- 5
- 13
14
votes
1 answer
history.pushState in Chrome make favicon request
Code :
var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname +"?"+ queryStr;
window.history.pushState({path:newurl},'',newurl)
Current scenario :
Every time when window.history.pushState() is invoked…

Debug Diva
- 26,058
- 13
- 70
- 123
14
votes
3 answers
How to implement deep linking client on top of HATEOAS server?
There's a similar question on SO, but it's not phrased well and it lacks details. So I'm trying to write a better question.
I'm interested in how to implement HATEOAS with a single page application (SPA) that is using pushState. I want to preserve…

Mark E. Haase
- 25,965
- 11
- 66
- 72
13
votes
2 answers
Pop the last state from history
Is it possible to get the html of the last state pushed to history stack, something like this:
history.pushState(null, null, {html: $('body').html()});
Change the window location:
window.location = url;
Now from the new location:…

shmnsw
- 639
- 2
- 11
- 24
13
votes
2 answers
Backbone.js routing without changing url
I am migrating a single-page web application based on Backbone.js and jQuery to a Chrome extension. However, neither the pushState nor the hashbang-based router modes seem to play well with the environment within the extension. I've come to the…

user2398029
- 6,699
- 8
- 48
- 80
13
votes
3 answers
When I push a new URL to Backbone.history, the query params stays?
Let's say I'm using Backbone pushstate and I navigate to a page with query params:
domain.com/user/111?hello=123
When I execute this:
Backbone.history.navigate('/settings', true);
My settings page loads perfectly, but the ?hello=123 stays in the…

TIMEX
- 259,804
- 351
- 777
- 1,080
12
votes
3 answers
preserving browser "back" button functionality using AJAX/jQuery to load pages and history.pushState() method
I'd like to preserve the back button functionality when loading pages via AJAX (jQuery load method) and pushing the URL to the browser bar via the history.pushState method. The problem occurs when one clicks on the browser back button and the 1st…

tim peterson
- 23,653
- 59
- 177
- 299