Permalink
Browse files

Merge pull request #306 from mobify/ios-preload-hit-fix

Added iOS8 preload-top-hits issue fix for v7 tag
  • Loading branch information...
donnielrt committed Sep 24, 2015
2 parents f2038d1 + 644c231 commit 4a4ff8a37ea69491fc2345b3c465e01257ae0612
Showing with 18 additions and 4 deletions.
  1. +15 −1 tag/v7.js
  2. +3 −3 tag/v7.min.js
View
@@ -202,6 +202,20 @@ Private['loadPreview'] = loadPreview;
@type {null}
*/
var disableTag = function() {
// This workaround addresses an iOS fallthrough issue, where
// iOS 8's "preload top hits" option will load a Mobified page
// in the background when typing in an address into the URL bar.
// Safari seems to cancel the mobify.js download, resulting in
// us dropping a failure cookie.
//
// We get around this by ignoring adaptive script failures in a
// background tab.
//
// Related ticket: https://mobify.atlassian.net/browse/RTM-280
if (document.visibilityState && document.hidden) {
return;
}
var now = new Date();
// Set now to 5 minutes ahead
now.setTime(now.getTime() + 5*60*1000);
@@ -343,7 +357,7 @@ Tag['init'] = function(options) {
src: opts['url'],
onerror: disableTag,
onload: postloadCallback
}
};
loadScript(options, "mobify");
};
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 4a4ff8a

Please sign in to comment.