Skip to content

Commit

Permalink
Work around popstate browser inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
aanand committed Apr 16, 2012
1 parent 382d181 commit ae65cf1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/composit.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,12 @@ exports.start = ->
$('*[name=query]').val(query)
doSearch(query)

window.addEventListener('popstate', doSearchFromQueryString)
popped = window.history.state?
initialURL = window.location.href

window.addEventListener 'popstate', (event) ->
initialPop = !popped && (window.location.href == initialURL)
(console.log("ignoring initial pop"); return) if initialPop
doSearchFromQueryString()

doSearchFromQueryString()

0 comments on commit ae65cf1

Please sign in to comment.