This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 7896 - Specify pageshow and pagehide events
Summary: Specify pageshow and pagehide events
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords: NE
Depends on:
Blocks:
 
Reported: 2009-10-12 09:11 UTC by Simon Pieters
Modified: 2010-10-04 13:55 UTC (History)
5 users (show)

See Also:


Attachments

Description Simon Pieters 2009-10-12 09:11:43 UTC
Apparently Gecko and WebKit have implemented pageshow and pagehide events (and onpageshow/onpagehide event handler attributes).

http://webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/

I guess this is something that should be specced in HTML5.
Comment 1 Maciej Stachowiak 2009-10-12 10:00:22 UTC
I agree, this is worth specifying. These events are becoming de-facto necessary to implement a Web-compatible back/forward cache.
Comment 2 Ian 'Hixie' Hickson 2009-10-21 06:07:25 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Concurred with reporter's comments.
Comment 3 contributor 2009-10-21 06:08:06 UTC
Checked in as WHATWG revision r4231.
Check-in comment: Add pageshow and pagehide events.
http://html5.org/tools/web-apps-tracker?from=4230&to=4231
Comment 4 Simon Pieters 2009-10-21 06:23:48 UTC
(In reply to comment #1)
> I agree, this is worth specifying. These events are becoming de-facto necessary
> to implement a Web-compatible back/forward cache.
> 

Maciej, could you check whether the spec matches what is implemented in WebKit, please?
Comment 5 Simon Pieters 2010-01-13 09:24:03 UTC
WebKit and Firefox uses the PageTransitionEvent interface, which has members .persisted and .initPageTransitionEvent().
Comment 6 Simon Pieters 2010-01-13 09:34:17 UTC
Also, pageshow should have target set to document (just like the load event).
Comment 7 Simon Pieters 2010-01-13 09:37:56 UTC
(In reply to comment #6)
> Also, pageshow should have target set to document (just like the load event).
> 

...and pagehide
Comment 8 Ian 'Hixie' Hickson 2010-02-13 01:14:45 UTC
What does .persisted return?
Comment 9 Simon Pieters 2010-02-17 11:55:05 UTC
It returns true for pageshow if the page is loaded by navigating in history and the page was not garbage collected, I think.

It always returns true for pagehide, AFAICT.
Comment 10 Ian 'Hixie' Hickson 2010-02-23 11:25:29 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Concurred with reporter's comments.
Comment 11 contributor 2010-02-23 11:29:26 UTC
Checked in as WHATWG revision r4800.
Check-in comment: Make pageshow/pagehide use PageTransitionEvent, to match reality as described by zcorpan.
http://html5.org/tools/web-apps-tracker?from=4799&to=4800