amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

this.isEmbedded_ is false in a WebView

Open ericfs opened this issue 10 years ago • 5 comments

https://github.com/ampproject/amphtml/blob/master/src/service/viewer-impl.js#L144

In a WebView, there is no win.parent so the above check is false.

What browsers are affected?

WebView

Which AMP version is affected?

All

ericfs avatar May 05 '16 20:05 ericfs

To expand, the window.parent is actually window, even though the WebView is a managed viewer context. We'll need a bit more to determine if we are inside a viewer, though the win.parent === win is a good check for other environments.

jridgewell avatar May 05 '16 20:05 jridgewell

Viewer.isEmbedded() is a bad name. It should be isIframed() - most of code that uses it actually cares whether or not the page is in iframe. I suggest we renamed isEmbedded to isIframed and then we can start using isEmbedded for viewer-based things.

dvoytenko avatar May 05 '16 22:05 dvoytenko

+1

On Thu, May 5, 2016 at 3:57 PM, Dima Voytenko [email protected] wrote:

Viewer.isEmbedded() is a bad name. It should be isIframed() - most of code that uses it actually cares whether or not the page is in iframe. I suggest we renamed isEmbedded to isIframed and then we can start using isEmbedded for viewer-based things.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/ampproject/amphtml/issues/3117#issuecomment-217303982

cramforce avatar May 06 '16 00:05 cramforce

Putting this in the backlog, but please feel free to change if there's a task here with a more specific target

ericlindley-g avatar May 09 '16 23:05 ericlindley-g

Already in review.

dvoytenko avatar May 09 '16 23:05 dvoytenko