 
   goToPage: (targetPanel,options) ->
 
+    @targetPanel = targetPanel
+
+    if @pageHistory.length > 1 and @pageHistory[@pageHistory.length - 2] == @targetPanel
+      @pageHistory.pop()
+      @back = true
+    else
+      @pageHistory.push(@targetPanel)
+
     if options?
       if options.back
         @back = options.back

  isTransitioning: false
  currentPanel: ''
  targetPanel: ''
  pageHistory: [window.location.hash]
  os: {}
  hideUrlBar: false


      # use window timeout to delay transition or will not work on android device
      window.setTimeout =>
        @currentPanel.style.webkitTransition = "#{@speed} ease"
        @currentPanel.style.webkitTransform = "translateX(200%)"
        @targetPanel.className += " visible"
      , 10

      # shortern the delay here to stop a gap appearing in android
      window.setTimeout =>
        @targetPanel.style.webkitTransition = "#{@speed} ease"
        @targetPanel.style.webkitTransform = "translateX(100%)"
        @currentPanel.addEventListener("webkitTransitionEnd", =>
          @finishTransition()
        , false);
      , 5

    else
      #do forward transition
