Fix Turbolinks.visit in Chrome on iOS 6.1.3 #199

Merged
merged 2 commits into from Mar 25, 2013

Projects

None yet

5 participants

@fshowalter

In Chrome on iOS 6.1.3, calling Turbolinks.visit will fail because
browserSupportsPushState returns true, but currentState is still null
(because browserIsntBuggy returns false) and thus the cacheCurrentPage
function will fail. This one-line fix ensures that when
Turbolinks.visit is called, if either browserSupportsPushState or
browserIsntBuggy returns false, we fall back to simply setting
document.location.href.

@frankshowalter frankshowalter fix for chrome on iOS 6.1.3
In Chrome on iOS 6.1.3, calling Turbolinks.visit will fail because
browserSupportsPushState returns true, but currentState is still null
(because browserIsntBuggy returns false) and thus the cacheCurrentPage
function will fail. This one-line fix ensures that when
Turbolinks.visit is called, if either browserSupportsPushState or
browserIsntBuggy returns false, we fall back to simply setting
document.location.href.
383900d
Collaborator
reed commented Mar 25, 2013

Looks good. Before I pull it in, could you please remove the .DS_Store file from the PR?

Done.

@reed reed merged commit 1114b6e into turbolinks:master Mar 25, 2013
Collaborator
reed commented Mar 25, 2013

Thank you

I'm get this error randomly when use Turbolinks.visit lots of times in a row.. but in chrome for mac.

More exactly, the issue is in:

 cacheCurrentPage = function() {
    rememberInitialPage();
    pageCache[currentState.position] = { // Uncaught TypeError: Cannot read property 'position' of null
      url: document.location.href,
      body: document.body,
      title: document.title,
      positionY: window.pageYOffset,
      positionX: window.pageXOffset
    };
    return constrainPageCacheTo(10);
  };

I currently have this issue in Chrome for Windows. Same line as @caarlos0.
version 30.0.1599.69 m.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment