amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Send window.loation.origin in `channelOpen`

Open ericfs opened this issue 9 years ago • 4 comments

It's possible for the cache to redirect. If that happens, an AMP Viewer won't know what target origin to send messages to. The channelOpen request should include the origin so that the messaging channel can be established. This will be an issue with per publisher cache subdomains.

/cc @chenshay

ericfs avatar Jan 31 '17 22:01 ericfs

/to @muxin

jridgewell avatar Feb 01 '17 00:02 jridgewell

See internal issue b/34466538 for more context.

ericfs avatar Feb 01 '17 00:02 ericfs

I don't understand why we should send it. The incoming message definitely comes with an origin tag (that should be the same value). You need to check event.origin.endsWith('.cdn.ampproject.org').

cramforce avatar Feb 01 '17 01:02 cramforce

Good point. That should be fine.

ericfs avatar Feb 01 '17 13:02 ericfs