       [url, action]
 
     dispatcher = (e) ->
-      prev = current
-      result = false
+      prev        = current
       route_array = null
+      result      = false
+
 
       if event.type == "hashchange"
         # hashchange
         route_array = array_of_routes
         current = window.location.hash
-        tgt = window.location.origin
-        history.replaceState({href: current}, "#{current}", "#{tgt}/#{current}")
+        if hash_on_top and push_state_support
+          origin = window.location.origin
+          history.replaceState({href: current}, "#{current}", "#{origin}/#{current}")
       else
         # plain
         route_array = plain_routes
         href = e.target.href # TODO the same for hashchange
-        history.pushState({href: href}, "#{href}", href)
+        history.pushState({href: href}, "#{href}", href) if push_state_support
         pathname = window.location.pathname
         pathname = "/" if pathname == ""
         if (e.preventDefault)

  # @event application:urlchange - generate, when url change
  # @event application:404 - generate, if given url not matched with given routes
  # @event application:run - generate, after application running
  create: (routes, fn = ->) ->
    current = prev = window.location.hash

    # set routing by event
    for url, action of routes when @_event_route(url)

      false


    if plain_routes.length != 0 
      # bind all <a> element with dispatch function, but bind only when href not contain "#"
      selector  = "a:not([href^='#'])"

