popstate Questions

3

I'm trying to add window.onpopstate on one of the pages on my site, but nothing is happening. I put this script on the page: <script type="text/javascript"> window.addEventListener('popstat...
Allineallis asked 7/4, 2015 at 20:15

0

I have a simple project in which I've included a modal component that can be closed by the browser's back button. When a modal is opened, a hash appears in the URL. If the user clicks the back butt...
Stative asked 9/4, 2023 at 13:28

1

I would like to display an image when the user clicks the back button of the browser. The code below worked fine in safari 15.5, but when I upgraded to safari 16.1, it did not work. Popstate not wo...
Galatians asked 28/10, 2022 at 9:12

2

In iOS 7 Safari there are now two ways to navigate back/forward -- using the traditional back/forward button arrows at the bottom or by swiping from the edge of the screen. I'm using an animation t...
Grange asked 29/10, 2013 at 15:25

2

I'm trying to use "pushState" and the "popstate" event to trap Back button navigation, however, while the popstate event triggers correctly in Firefox, it doesn't trigger in Chrome (Version 76.0.38...
Galatea asked 3/8, 2019 at 14:12

1

Solved

I would like to update window.location.search without reloading the document and then execute a function based on the updated values in window.location.search. When the user clicks a button, that ...
Threefold asked 21/9, 2019 at 11:7

2

Here's a simple example of pushState and popstate event: <button id="example_btn">Click me</button> <script> $("#example_btn").click(function(){ history.pushState( { 'url' :...
Oscitant asked 17/5, 2016 at 8:13

1

How to cache page loaded via ajax with pushState URL so that reloading page from server can be avoided? For instance, page 1: /foo.html. click button, send ajax request, get response and update th...
Dagan asked 18/5, 2014 at 3:5

2

I'm trying to stop the user from going back in my web app. For this I tried catching the window.onpopstate and added e.preventDefault to cancel the back button effect. But it doesn't seems to happ...
Dihydric asked 7/9, 2015 at 6:24

2

Solved

I have tried to type this code into the browser's console: window.onpopstate = function() {alert(1);} and then click the back button. No alert has shown. Am I doing something wrong? Or is it not...
Triclinic asked 7/2, 2013 at 10:9

2

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.locat...
Rycca asked 17/4, 2015 at 18:28

1

Using Ajax and trying to create a popstate event handler on the actual Ajax page using the .document object: document.addEventListener("popstate", myPopState); Unfortunately this does not ever s...
Blackwood asked 15/9, 2016 at 16:18

1

Solved

Is there any way I can get the new page's url when the window.popstate is fired? window.onpopstate(function (){ newPageUrl = //get the new page's URL })
Brunhilda asked 15/9, 2016 at 5:15

5

Solved

I have been trying to get the forward an back browser buttons to work on a small site using pjax and have come up with the following code to handle class changes and fading in and out the various o...
Durrell asked 25/5, 2012 at 15:8

5

Solved

I'm working on a site that serves content via AJAX. If you click an item in the menu, a content div gets updated with $.get response, nothing fancy. I'm implementing history.pushState to allow na...
Telpherage asked 6/3, 2011 at 10:47

4

I have a simple web page, namely: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>History hacks</title> &l...
Tullis asked 11/10, 2012 at 13:18

2

Solved

Some our links are wrapped by PJAX. When a user clicks on a PJAX link the server returns only the required part of the HTML. If I do the following: Click PJAX link Click simple link Press back...
Protest asked 26/7, 2012 at 6:47

3

Solved

To improve the performance/responsiveness of my website I have implemented a partial page load using AJAX, replaceState, pushState, and a popstate listener. I essentially store the central part of...
Voelker asked 28/6, 2012 at 9:1

2

Solved

I am working on a small project in which I want to create an Ajax-style website. Content is loaded with jQuery's load(). As some of you know, the down side of this is that the URL does not change a...
Harriet asked 17/5, 2012 at 8:51

0

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 swit...
Suspension asked 28/10, 2012 at 7:36
1

© 2022 - 2024 — McMap. All rights reserved.