How to Make AMP Pages Work Across Browsers
AMP pages work in modern browsers and app webviews. Build valid markup, follow AMP’s CSS and JavaScript rules, and test the browsers your audience uses.
AMP pages do not require a special browser. AMP is a constrained HTML format that renders in modern browsers and app webviews using the browser’s normal rendering engine plus the AMP runtime. That general support statement is not a guarantee for every browser version or device, so validate the page and test the specific browsers, devices, and embedded webviews your audience uses.
Cross-browser reliability comes from four separate checks: valid AMP markup, compliant CSS and supported interactions, visual and functional testing in your target browsers, and correct canonical/discovery links. A page can render in a browser while still failing AMP validation or being ineligible for distribution through systems that require valid AMP.
1. Start with a valid AMP document
Use the required document structure, metadata, runtime, and boilerplate. This minimal page demonstrates the foundation. Replace the example canonical URL and content with your own, and keep the canonical URL absolute.
<!doctype html>
<html amp lang="en">
<head>
<meta charset="utf-8">
<title>Example AMP page</title>
<link rel="canonical" href="https://example.com/article/">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style>
<noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<style amp-custom>
body { font-family: system-ui, sans-serif; margin: 0 auto; max-width: 42rem; padding: 1rem; }
amp-img { background: #eee; }
</style>
</head>
<body>
<main>
<h1>An AMP page that adapts to the viewport</h1>
<p>Keep content readable at narrow and wide widths.</p>
<amp-img src="https://example.com/image.jpg" width="1200" height="800" layout="responsive" alt="A descriptive alternative text"></amp-img>
</main>
</body>
</html>
The required boilerplate can be copied exactly from the official AMP documentation if you prefer not to maintain it by hand. The example uses amp-img, which reserves space from its declared dimensions and uses AMP’s component behavior. Check every component against its documentation; extension components need their own asynchronous script in the head.
2. Keep layout responsive and CSS within AMP rules
AMP constrains page CSS so the document can be validated and its layout handled predictably. Put page styles in one <style amp-custom> block or use supported inline style attributes. Ordinary external stylesheets are not allowed, except for supported custom-font providers. The CSS budget is 75,000 bytes per page. Avoid unsupported CSS and !important; validate after style changes.
- Set dimensions on images and other media. Use AMP layout attributes such as
layout="responsive"when the element should scale with its container. - Check narrow, intermediate, and wide viewports. A valid page can still have cramped text, overflow, or poorly sized controls.
- Reserve space for embedded content and images so delayed resources do not unexpectedly shift the surrounding layout.
- Use responsive CSS and supported AMP components for interactions and media instead of relying on browser-specific markup or scripts.
AMP validity and visual quality are different checks: passing the validator does not establish that every layout looks right at your chosen viewport sizes.
3. Use AMP-supported interaction patterns
Ordinary author-written JavaScript in script tags is disallowed by AMP validation. Prefer the AMP runtime and components for common interactions. For a requirement that needs author JavaScript, review amp-script and its documented DOM and Web API constraints before adopting it. If a component is used, include the component’s required script and verify that it works in the browsers and webviews you support.
Do not make essential content depend on an unsupported script executing. Ensure the document remains understandable if a nonessential enhancement is delayed or unavailable, and check the developer console for runtime errors as well as validator errors.
4. Validate the page, then test real browsers
- Open the local or deployed AMP page with
#development=1appended to its URL. - Open the browser developer console and resolve the AMP validation errors it reports.
- Alternatively, check the page with the AMP Validator web interface, browser extension, or command-line validator.
- After validation passes, test the page in the browser versions, device classes, viewport sizes, and app webviews your site promises to support.
- Check the important outcomes separately: content and layout render, controls work, media loads, and the page is discoverable through the intended canonical/AMP links.
There is no browser-version support matrix established by the AMP guidance summarized here. Treat “modern browsers” as broad guidance, not a version guarantee. Invalid AMP may not be discovered or distributed by third-party systems and may not appear in Google AMP Cache; that distribution consequence is separate from whether a browser can render the document directly.
5. Connect the AMP page to its canonical page
If a conventional HTML page has an AMP alternative, put an amphtml link in the canonical page’s raw HTML, and point the AMP page back to the canonical URL. The discovery relation should be available without JavaScript.
<!-- In the canonical HTML page's head -->
<link rel="amphtml" href="https://example.com/article/amp/">
<!-- In the AMP page's head -->
<link rel="canonical" href="https://example.com/article/">
When AMP itself is the canonical representation, its canonical link points to itself. Use the actual preferred canonical URL, and make sure redirects and trailing-slash conventions do not leave the two documents pointing at inconsistent addresses.
6. A practical browser test checklist
- Browser coverage: list the browser families and versions your audience uses, including embedded webviews if relevant.
- Viewport coverage: check narrow phones, larger phones, tablets, and desktop widths that matter to your layout.
- Direct rendering: open the AMP URL directly, rather than testing only a cached or platform-rendered copy.
- Validation: confirm the validator reports no AMP errors on the current deployed markup.
- Core content: check headings, text, images, links, and any component-driven content.
- Interaction: test navigation, forms, menus, and component controls with touch and pointer input where applicable.
- Discovery: inspect the raw HTML for the canonical and
amphtmllinks. - Regression: repeat the checks after changing CSS, component scripts, metadata, or templates.
A screenshot can help compare layout across browsers, but it cannot establish that a page passes AMP validation or that a button, form, or embedded component behaves correctly.
7. Troubleshooting common failures
| Symptom | Likely cause | What to do |
|---|---|---|
| The page renders, but AMP validation fails. | Required metadata, boilerplate, runtime, or component markup is missing or malformed. | Use the validator output to find the offending line; add the required document pieces or correct the invalid element. |
| A component is unknown or invalid. | Its extension script is missing, has the wrong version, or does not match the component markup. | Use that component’s official AMP instructions and include its asynchronous script in the document head. |
| Custom styles are rejected. | CSS uses unsupported syntax, exceeds the page budget, or violates AMP styling rules. | Remove or replace the reported declaration, reduce the CSS, and keep page styles in the permitted AMP style block or inline attributes. |
| A layout breaks only at certain widths. | Fixed sizing, missing media dimensions, overflow, or a responsive rule that does not fit the content. | Inspect the affected viewport, declare element dimensions, use responsive layout behavior, and adjust the relevant CSS. |
| An interaction works in one browser but not another. | The implementation relies on unsupported author JavaScript, a component issue, or a browser/webview difference. | Move the behavior to a supported AMP component where possible; inspect console errors and test the documented component behavior in target environments. |
| The page opens directly but is not surfaced by a platform. | AMP validation may fail, or the canonical/AMP relationship may be absent or inconsistent. | Validate the deployed page and inspect both links in raw HTML. Remember that distribution eligibility is separate from direct browser rendering. |
| A local page does not show useful validation output. | Development mode was not enabled, or the console was not inspected. | Append #development=1 to the page URL and inspect the browser developer console. |
8. Performance, reliability, and cost considerations
AMP’s required structure and constrained CSS help make layout requirements explicit, but they do not guarantee a particular load time or identical rendering on every browser. Performance still depends on page content, network conditions, image sizes, component behavior, and the target device. Declare media dimensions, keep styles within the documented limit, and verify real pages under the conditions your audience experiences.
For reliability, validate every template and representative page after changes, and include the browser and webview targets in release checks. Keep canonical relationships in raw HTML so discovery does not depend on client-side JavaScript. No browser-by-browser compatibility study or performance benchmark is established by the sources used for this guide, so avoid turning general AMP support into a guarantee.
AMP itself does not specify a cost for authoring or browser testing. Budget for the infrastructure and tools your project actually uses; the AMP CSS limit is a format constraint, not a pricing or performance figure.
9. Capture browser results for visual review
For repeatable visual comparisons, capture the same AMP URL at the same viewport and state in each browser you support. Keep screenshots alongside the browser, device, viewport, and page revision details so a visual difference can be reproduced. Treat captures as a layout aid and pair them with validation and interaction checks.
ScreenshotNeo is a website screenshot API and MCP server from Yorker Media. Its API can capture a URL as PNG, JPEG, WebP, or PDF, and its parameters include viewport/device settings, full-page capture, custom CSS and JavaScript, and selector-based capture. See the ScreenshotNeo site and API documentation.
Or skip the browser setup
One GET request captures a URL. Replace YOUR_API_KEY with your key and change the target URL as needed. The documented request and options are at ScreenshotNeo’s API docs.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/article/amp/ -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://example.com/article/amp/"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com/article/amp/' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));
ScreenshotNeo accepts cookie and consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits cost nothing, and response headers say the page verdict and whether the request was billed. Its MCP server gives AI agents tools for screenshots, page information, and PDF capture. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots. These captures help with visual review and do not replace AMP validation or functional browser testing.
Sign up for 1,000 free screenshots a month, with no card required.
FAQ
Do AMP pages need a special browser?
No. AMP documents are HTML pages rendered by modern browsers and app webviews with the AMP runtime and supported components.
Does a page that opens in my browser count as valid AMP?
No. Direct rendering and AMP validation are separate checks. Use the validator to check format compliance.
Does valid AMP guarantee that every browser version works?
No browser-version guarantee follows from the broad modern-browser support statement. Test the actual browser versions and webviews you support.
Can screenshots prove AMP compatibility?
No. A screenshot records appearance at a particular moment. It does not verify markup validity or interaction behavior.


