Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up instagram and twitter embeds. #2155

Merged
merged 1 commit into from
Feb 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions extensions/amp-instagram/0.1/amp-instagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {loadPromise} from '../../../src/event-helper';
class AmpInstagram extends AMP.BaseElement {
/** @override */
preconnectCallback(onLayout) {
this.preconnect.url('https://instagram.com', onLayout);
this.preconnect.url('https://www.instagram.com', onLayout);
}

/** @override */
Expand All @@ -63,7 +63,7 @@ class AmpInstagram extends AMP.BaseElement {
const iframe = document.createElement('iframe');
iframe.setAttribute('frameborder', '0');
iframe.setAttribute('allowtransparency', 'true');
iframe.src = 'https://instagram.com/p/' +
iframe.src = 'https://www.instagram.com/p/' +
encodeURIComponent(shortcode) + '/embed/?v=4';
this.applyFillContent(iframe);
iframe.width = width;
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-instagram/0.1/test/test-amp-instagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('amp-instagram', () => {
const iframe = ins.firstChild;
expect(iframe).to.not.be.null;
expect(iframe.tagName).to.equal('IFRAME');
expect(iframe.src).to.equal('https://instagram.com/p/fBwFP/embed/?v=4');
expect(iframe.src).to.equal('https://www.instagram.com/p/fBwFP/embed/?v=4');
expect(iframe.getAttribute('width')).to.equal('111');
expect(iframe.getAttribute('height')).to.equal('222');
});
Expand Down
2 changes: 2 additions & 0 deletions extensions/amp-twitter/0.1/amp-twitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class AmpTwitter extends AMP.BaseElement {
preconnectCallback(onLayout) {
// This domain serves the actual tweets as JSONP.
this.preconnect.url('https://syndication.twitter.com', onLayout);
// All images
this.preconnect.url('https://pbs.twimg.com', onLayout);
// Hosts the script that renders tweets.
this.preconnect.prefetch('https://platform.twitter.com/widgets.js');
prefetchBootstrap(this.getWin());
Expand Down