amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

amp-app-banner: doesn't show up in AMP Viewer in Chrome on Android

Open sebastianbenz opened this issue 10 years ago • 9 comments

How do we reproduce the issue?

Open the following link in Chrome on Android: https://google.com/amp/ampbyexample.com/components/amp-app-banner/

=> the app banner doesn't appear

sebastianbenz avatar Dec 02 '16 07:12 sebastianbenz

//cc @ericlindley-g @mkhatib

sebastianbenz avatar Dec 02 '16 07:12 sebastianbenz

I can also repro with the viewer link (as opposed to the AMP Cache link from the repro steps. The AMP Cache link works as expected for me)

Any thoughts on this, @mkhatib ?

ericlindley-g avatar Dec 02 '16 17:12 ericlindley-g

Hey, I've managed to track this down to the lack of /s/ in the viewer URL to indicate that the page should be loaded over https.

This is probably the correct behavior when /s/ is omitted, the xhr-impl fails an assertion that the amp-access-control-allow-source-origin returned by the response to the manifest https://ampbyexample.com is not equal to http://ampbyexample.com (no https) hence the app banner fails to show.

Does this make sense?

mkhatib avatar Dec 05 '16 21:12 mkhatib

@mkhatib — thanks for tracking this down!

Do we need to require that the original page be served through https in order to show the AMP banner in the viewer context? I know it's a requirement for the system banner (outside of the viewer context), but I assume that will take care of itself in the non-viewer Chrome + Android setting without AMP adding an additional behavior.

Also, I believe AMP by Example is served via HTTPS, and that the google viewer doesn't include an /s/ for HTTPS pages. If HTTPS is a requirement, can we use a different method to determine?

ericlindley-g avatar Dec 05 '16 22:12 ericlindley-g

Do we need to require that the original page be served through https in order to show the AMP banner in the viewer context?

The problem was the mismatch between where the page was served and where the manifest was pointing. But in general yes, since we already enforce manifest to be served from https the host must be on https as well.

Also, I believe AMP by Example is served via HTTPS, and that the google viewer doesn't include an /s/ for HTTPS pages.

Can we make sure of this assumption? Cause if it's true, then our logic of getting the origin source URL is invalid:

const origin = domainOrHttpsSignal == 's'
      ? 'https://' + decodeURIComponent(path[3])
      : 'http://' + decodeURIComponent(domainOrHttpsSignal);

And the Google Viewer seems to be embedding a link like: https://cdn.ampproject.org/v/ampbyexample.com/components/amp-app-banner/... - without an /s/.

mkhatib avatar Dec 05 '16 22:12 mkhatib

@mkhatib: The viewer will use /v/s if the page is HTTPS. What did you do to get iframe src above?

jridgewell avatar Dec 06 '16 20:12 jridgewell

It works if you add the /s to the viewer url: https://www.google.com/amp/s/ampbyexample.com/components/amp-app-banner/

ericfs avatar Dec 06 '16 20:12 ericfs

Got it — so the Google AMP Viewer will always add the /s/ to the url, and the Google AMP Cache will always add the /s/ to the URL, which amp-app-banner will look for and behave appropriately. It looks like it was my method of testing that was flawed in these cases.

@mkhatib What about other caches? Do we have a system that will work for those?

ericlindley-g avatar Dec 06 '16 21:12 ericlindley-g

I am not entirely sure about other viewers. But it looks like yes this was a problem with the testing method - forgetting to add /s/ part of the viewer URL.

Closing this

mkhatib avatar Feb 14 '17 01:02 mkhatib