Opened 10 years ago
Closed 10 years ago
#14184 closed bug (notabug)
.on('popstate', function(e){}) does not pick up e.state data
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.10.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
implementing ajax history:
$('a').click(function(e){ e.preventDefault(); var d = this.href; window.history.pushState({data: d}, d, d); $('#state').text(d); });
when using:
window.onpopstate = function(e){ var d = e.state || {data: 'no state'}; $('#state').text(d.data); };
the history can pop up the pushed state. but when using:
$(window).on('popstate', function(e){ var d = e.state || {data: 'no state'}; $('#state').text(d.data); });
the pushed state can not be popped up, although the event is triggered
Change History (2)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
http://api.jquery.com/category/events/event-object/
Certain events may have properties specific to them. Those can be accessed as properties of the event.originalEvent object.
Note: See
TracTickets for help on using
tickets.
tested on chrome Version 28.0.1500.72 m and firefox 22
implementing ajax history:
when using:
http://jsfiddle.net/jBHgU/
the history can pop up the pushed state. but when using:
http://jsfiddle.net/hQTTX/1/
the pushed state can not be popped up, although the event is triggered