Reputation: 1074
I'm working on a web app to aggregate news. I want to show amp enabled pages in the same window as google search result shows on mobile devices.
I have not found a single document on how to embed an amp page on our website.
I tried these two links-
PolyerLab - This one does not load pages because of CORS is disabled by chrome so couldnt test it further, (I wonder does it ignore the CORS restriction for google.com?)
AMP by Example - viewer from official ampproject website, files amp-viewer-host.max.js
and viewer-integr-messaging.js
required for `viewer.html' are missing from the git repository.
There is no question on stackoverflow as well on this. Has anyone implemented something like this already? Help much appreciated!
Upvotes: 1
Views: 971
Reputation: 67
You can go to the actual site page which has amphtml & url of amp page. Just load that url in iframe.
example :
site page :
www.example.com/product_page it has <link rel="amphtml" href="www.example.com/product_page_amp-version.html"> in its <head>
to embed use
<iframe src="www.example.com/product_page_amp-version.html"></iframe>
Upvotes: 0
Reputation: 4288
The example in the official repository is the best way to get started with implementing your own AMP viewer. You get amp-viewer-host.max.js
when you build the AMP runtime locally. It's located in: dist/v0/examples/amp-viewer-host.max.js
after running gulp build
. The other file viewer-integr-messaging.js
is no longer needed.
Upvotes: 3