AMP コンテンツを統合する
ここでは、AMP キャッシュ URL を統合し、それらの URL にアクセスするためのおすすめの方法を、アプリケーションのタイプと各種プラットフォーム別に紹介します。
ウェブ アプリケーションの AMP キャッシュ URL
ドキュメントのパソコン向けが正規バージョンで、モバイル向けが AMP バージョンの場合は、AMP バージョンで AMP キャッシュ URL にリンクします。
ウェブページを最もすばやく開くには、モバイル デバイスのシステム ブラウザ(Android デバイスの場合は Chrome、iOS デバイスの場合は Safari)で AMP キャッシュ URL を開きます。
iOS アプリの AMP Cache URL
iOS アプリでリンクを開く場合、SFSafariViewController を使用することをおすすめします。SFSafariViewController はブラウザの状態をシステム ブラウザ(Safari)と共有します。ただし、SFSafariViewController
にはプリレンダリング API がないため、AMP の操作性をさらに最適化する方法はありません。
Android アプリの AMP Cache URL
Android アプリでリンクを開く場合、Chrome のカスタムタブを使用することをおすすめします。Chrome のカスタムタブは高速かつ安全で、ブラウザの状態を Chrome と共有します。つまり、ユーザーが Chrome でウェブサイトにログインすると、カスタムタブでも同じウェブサイトにログインします。
カスタムタブは AMP との相性が抜群です。カスタムタブのプリレンダリング API では、mayLaunchUrl(url, moreUrls)
を使用して、単一のページを完全にプリレンダリングするか、複数のページに事前接続します。
カスタムタブのパフォーマンスを最大限に高めるには、次の 3 つの操作を行う必要があります。
- カスタムタブをウォームアップします(リンクを開く時間を最大で 700 ミリ秒短縮できます)。
- ユーザーが開く可能性が高い(50% 超の確率)URL のコンテンツをプリフェッチします。その場合は
mayLaunchUrl
を使用します。
- ユーザーが複数のアイテム(記事中のリンクなど)のいずれかをクリックする可能性がある場合は、DNS 事前接続を行います。これにより、すべての URL に対して DNS ルックアップが実行されます(コンテンツはダウンロードされません)。DNS 事前接続を行うには、
mayLaunchUrl
の最初の 2 つのパラメータを null に設定して、URL のリストをまとめて渡します。
Chrome のカスタムタブでは、ユーザーがスマートフォンを従量制のネットワーク上で使用しているかどうかや、ローエンド デバイスかどうかを確認できます。ローエンド デバイスの場合、プリレンダリングによって全体的なパフォーマンスが低下するため、プリフェッチやプリレンダリングは行われません。したがって、この場合にアプリを最適化する必要はありません。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-02-17 UTC。
[null,null,["最終更新日 2025-02-17 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"]]