Skip to content

Commit

Permalink
Deactivate document preload for Safari (#8196)
Browse files Browse the repository at this point in the history
It doesn't support it and it doesn't use the same cache for `as`-attribute-less preload and document fetches.
  • Loading branch information
cramforce committed Mar 16, 2017
1 parent 3579d60 commit 84183df
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/preconnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ class PreconnectService {
const command = this.features_.preload ? 'preload' : 'prefetch';
this.urls_[url] = true;
this.url(viewer, url, /* opt_alsoConnecting */ true);
if (opt_preloadAs == 'document' && this.platform_.isSafari()) {
// Preloading documents currently does not work in Safari,
// because it
// - does not support preloading iframes
// - and uses a different cache for iframes (when loaded without
// as attribute).
return;
}
viewer.whenFirstVisible().then(() => {
const preload = this.document_.createElement('link');
preload.setAttribute('rel', command);
Expand Down

0 comments on commit 84183df

Please sign in to comment.