<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>18405</bug_id>
          
          <creation_ts>2012-07-25 17:35:47 +0000</creation_ts>
          <short_desc>History API: Clearly define popstate event behaviour on page load</short_desc>
          <delta_ts>2012-09-18 23:07:31 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>18605</dup_id>
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#traverse-the-history</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jörn Zaefferer">joern.zaefferer</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ian</cc>
    
    <cc>mike</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>71462</commentid>
    <comment_count>0</comment_count>
    <who name="Jörn Zaefferer">joern.zaefferer</who>
    <bug_when>2012-07-25 17:35:47 +0000</bug_when>
    <thetext>Currently the spec for the new history API (history.pushState and popstate event, http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html) is ambigous about when to trigger a popstate event, at least ambigous enough for Chrome/Safari and Firefox to differ in a severe way (from an API user perspective).

The MDN article on popstate (https://developer.mozilla.org/en/DOM/window.onpopstate) puts it like this: &quot;Browsers tend to handle the popstate event differently on page load. Chrome and Safari always emit a popstate event on page load, but Firefox doesn&apos;t.&quot;

I&apos;d like to see this clearly defined in the spec, so that users can use the API without requiring libraries like History.js (https://github.com/balupton/History.js/).

Or custom workarounds like these:
http://stackoverflow.com/questions/4688164/window-bind-popstate 
http://stackoverflow.com/questions/6421769/popstate-on-pages-load-in-chrome
Or unreliable timeouts:
http://dropshado.ws/post/15251622664/ignore-initial-popstate

Considering the workarounds, the right behaviour seems to be the one as implemented in Firefox: Don&apos;t trigger popstate on page load, as that is a distinct event anyway.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74055</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-09-18 23:07:31 +0000</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 18605 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>