Integrate AMP Content
Stay organized with collections
Save and categorize content based on your preferences.
These are the preferred ways of integrating and accessing AMP Cache URLs
based on your application type and the different platforms.
AMP Cache URLs in web applications
If your document has a canonical version for desktop
and an AMP version for mobile,
link to AMP Cache URLs in the AMP version.
To ensure the fastest version of a webpage,
open AMP Cache URLs on the mobile device's system browser:
on an Android device, in Chrome; on an iOS device, in Safari.
AMP Cache URLs in iOS applications
SFSafariViewControllers
are the preferred way to open links in an iOS app.
They share the same browser state with the system browser (Safari).
However, there is no way to further optimize the AMP experience
with SFSafariViewController
due to the lack of pre-rendering APIs.
AMP Cache URLs in Android applications
Chrome Custom Tabs
are the preferred way to open links in an Android app.
They are fast and secure, and they share the browser state with Chrome.
This means if users are logged into a website in Chrome,
they are logged into the same website in a Custom Tab.
Custom Tabs work very well with AMP.
With mayLaunchUrl(url, moreUrls)
,
they provide a pre-rendering API to either fully pre-render a single page
or pre-connect to multiple pages.
You should do three things to get the best performance out of a custom tab:
- Warm up the custom tab
(this saves up to 700ms when you open a link with it).
- Prefetch content for URLs the user is likely to open (likelihood >50%).
Use
mayLaunchUrl
for this.
- Perform a DNS preconnect if the user might click one of several items
(for example, links in an article).
This will perform a DNS lookup for all URLs,
but does not download any content.
To do this, set the first two parameters in
mayLaunchUrl
to null and
pass the list of URLs via the bundle.
Chrome Custom Tabs can determine if the user is using the phone
on a metered network or if it’s a low-end device.
On lower-end devices, pre-rendering has a negative effect on the overall performance and won’t pre-fetch or pre-render.
So, there’s no need to optimize your application for those cases.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-08-30 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-08-30 UTC."],[[["AMP Cache URLs should be linked within AMP versions of webpages and opened in the system browser (Chrome for Android, Safari for iOS) for optimal speed."],["SFSafariViewControllers are recommended for opening links in iOS apps, but lack pre-rendering capabilities for further AMP optimization."],["Chrome Custom Tabs are the preferred method for opening links in Android apps, offering pre-rendering APIs and seamless integration with AMP for enhanced performance."],["To maximize Custom Tab performance, warm up the tab, prefetch likely content using `mayLaunchUrl`, and perform DNS preconnects for potential links."],["Chrome Custom Tabs automatically adjust behavior on metered networks or low-end devices, eliminating the need for specific optimization in those scenarios."]]],["Web applications should link to AMP Cache URLs in their mobile versions. On mobile devices, AMP Cache URLs should be opened in the system browser (Chrome for Android, Safari for iOS). iOS apps should use `SFSafariViewController` to open links. Android apps should use Chrome Custom Tabs, which enable link pre-rendering via `mayLaunchUrl`. For optimal performance, warm up the tab, prefetch content for likely URLs, and use DNS preconnect for multiple potential links. Pre-rendering is avoided on low-end devices.\n"]]