Search code examples
javascripthtmlhtml5-history

Multiple onpopstate event


I need to work with History API for an application. My problem is that some "home" jQuery plugins already implement an event for popstate

it is possible to have more than one popstate event for an unique view ?


Solution

  • window.addEventListener("popstate", console.log);
    window.addEventListener("popstate", function(){console.log("I am also called")});
    

    This seems to work fine for me.

    Edit: Now with multiple events. For some reason Chrome won't fire twice the console log of the event though