惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

有赞技术团队
有赞技术团队
量子位
B
Blog RSS Feed
Schneier on Security
Schneier on Security
L
LINUX DO - 最新话题
博客园 - 三生石上(FineUI控件)
Recent Announcements
Recent Announcements
Hacker News: Ask HN
Hacker News: Ask HN
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google DeepMind News
Google DeepMind News
N
News | PayPal Newsroom
阮一峰的网络日志
阮一峰的网络日志
Microsoft Security Blog
Microsoft Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Tailwind CSS Blog
MongoDB | Blog
MongoDB | Blog
大猫的无限游戏
大猫的无限游戏
PCI Perspectives
PCI Perspectives
aimingoo的专栏
aimingoo的专栏
D
Docker
T
The Exploit Database - CXSecurity.com
Last Week in AI
Last Week in AI
W
WeLiveSecurity
Stack Overflow Blog
Stack Overflow Blog
月光博客
月光博客
Vercel News
Vercel News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
J
Java Code Geeks
O
OpenAI News
C
Cisco Blogs
Hacker News - Newest:
Hacker News - Newest: "LLM"
爱范儿
爱范儿
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Threat Research - Cisco Blogs
Cisco Talos Blog
Cisco Talos Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Help Net Security
Help Net Security
Scott Helme
Scott Helme
The Hacker News
The Hacker News
Y
Y Combinator Blog
A
Arctic Wolf
V
V2EX
P
Proofpoint News Feed
Simon Willison's Weblog
Simon Willison's Weblog
A
About on SuperTechFans
S
Securelist
G
Google Developers Blog
Cyberwarzone
Cyberwarzone
The GitHub Blog
The GitHub Blog

The Astro Blog

Astro 6.4 Astro 6.3 Starlight 0.39 Astro 6.2 What's new in Astro - April 2026 What's new in Astro - March 2026 Astro 6.1 CloudCannon Joins Astro as an Official CMS Partner Astro 6.0 What's new in Astro - February 2026 What's new in Astro - January 2026 Astro 5.17 Supporting the future of Astro The Astro Technology Company joins Cloudflare Astro 6 Beta What's new in Astro - December 2025 What's new in Astro - November 2025 Astro 5.16 Stainless Sponsors Astro, Launches Astro-Powered Docs Platform What's new in Astro - October 2025 Astro 5.15 Spirit of Astro: meet the winning designs What's new in Astro - September 2025 Astro 5.14 Cloudflare Donates $150,000 to Support Astro's Open Source Mission Webflow Donates $150,000 to Support Astro's Open Source Mission Mux: Our Official Video Partner Unleashing creativity: How CodeTV built a video streaming platform with Astro and Mux | Astro What's new in Astro - August 2025 Astro 5.13 What's new in Astro - July 2025 Astro 5.12 Starlight 0.35 Astro 5.11 What's new in Astro - June 2025 Live Content Collections: A Deep Dive Introducing… Astro Mart Astro Solstice Festival Astro 5.10 Astro 5.9 What's new in Astro - May 2025 Astro 5.8 What's new in Astro - April 2025 2025 Technical Steering Committee Starlight April Update Astro 5.7 Astro Agency Partner Program Astro 5.6 What's new in Astro - March 2025 Astro 5.5 What's new in Astro - February 2025 Astro 5.4 Starlight 0.32 Astro 5.3 What's new in Astro - January 2025 Astro 5.2 2024 year in review What's new in Astro - December 2024 Astro 5.1 Astro 5.0 Google IDX: Our Official Online Editor Partner What's new in Astro - November 2024 What's new in Astro - October 2024 Astro x Cloudinary SDK What's new in Astro - September 2024 Community Loaders for Astro Content Layer Astro x Hygraph: Content Loader Astro x Cloudinary: Content Loader Astro x Storyblok: Content Loader Content Layer: A Deep Dive Starlight 0.28 Astro 5.0 Beta Release The $100,000 Astro Ecosystem Fund Fall Update Goodbye Studio, Hello DB What's new in Astro - August 2024 Astro 4.15 Astro 4.14 Astro 4.13 What's new in Astro - July 2024 Astro 4.12: Server Islands Netlify: Our Official Deployment Partner What's new in Astro - June 2024 Astro 4.11 Astro Together 2024 Server Islands The Astro Content Layer Astro 4.10 Starlight turns one year old! What's new in Astro - May 2024 Astro 4.9 Astro 4.8 What's new in Astro - April 2024 Astro 4.7 Astro 4.6 What's new in Astro - March 2024 Migrating 500+ tests from Mocha to Node.js Astro DB: A Deep Dive The Astro Developer Portal Astro DB Astro 4.5
Zero-JavaScript View Transitions
Fred Schott · 2024-06-11 · via The Astro Blog

This is Part 1 of our series on “The Future of Astro” covering three major new features we have planned for Astro in 2024. This post introduces an update to the View Transitions API that Astro can now leverage for native, app-like page navigation without a single line of JavaScript required.

The View Transitions API is a set of new platform APIs that unlock native browser transitions between pages. Historically this has only been possible in JavaScript-heavy Single Page Applications (SPAs), but recent advances are now bringing native page transitions to the web platform.

Astro users have had early access to view transitions since Astro 2.9. Due to initial limitations in the browser, our early support worked by injecting a JavaScript router onto the page to manage the animations for you. This was never meant as a long-term solution, but it successfully created an early playground for our users to explore:

Watch Joe Bell demo view transitions.

Try out this live demo by Maxi Ferreira.

Our bet was that the major web browsers would continue to improve and one day we could remove our JavaScript router shim entirely. One day, when a user clicked a link, that click could trigger a transition animation in the browser as part of its normal flow from page to page.

I’m excited to announce that that day has finally arrived. Chrome 126 (released last week) and Microsoft Edge 126 (releasing this week) both support “cross-document view transitions” unlocking zero-JavaScript view transitions in Astro.

Demo

Both Chrome and Edge rollout new browser versions gradually, so check that you are on version 126 before running the demo. In Chrome, you can see your current version at chrome://settings/help. If an upgrade isn’t available yet for your browser, check back later or use a Beta or Canary release channel instead.

Open the astro-zerojs-transitions.vercel.app demo to experience zero-JavaScript view transitions in your browser. You can explore your browser’s Network Panel to verify that every link click triggers a full page load, and zero JavaScript is being sent to the browser. If your browser supports it, the demo should look like this:

Spotify clone built with Astro View Transitions

If your browser does not support the latest cross-domain view transitions, then your website will still run and display content as expected. However, the animations will be disabled and page navigation will behave like any other navigation in your browser (without animation).

Enable Zero-JavaScript View Transitions

To take advantage of the native new View Transition API, it’s as simple as adding the @view-transition at-rule to your website. Here’s all the CSS you need:

<style>

@view-transition {

navigation: auto; /* enabled! */

}

</style>

Note: The built-in CSS syntax highlighter in some code editors (ex: VSCode) may struggle to parse the newer @view-transition at-rule syntax. You can add a comment like /* enabled! */ to your CSS as a short-term fix for your highlighter.

To enable cross-document view transitions, both “ends” of the transition must include this rule. A shared page layout component can be a good place to add this to your codebase.

Upgrade an Existing Project

If you were already using Astro View Transitions powered by our <ViewTransitions /> component, then it is now safe to remove that component and replace it with the at-rule. This will remove the injected backwards-compatible JavaScript router from your page, reducing the overall complexity of your client-side code.

---

import { ViewTransitions } from "astro:transitions";

---

<head>

<ViewTransitions fallback="none" />

<style>

@view-transition {

navigation: auto;

}

<style>

</head>

If you would still like your view transitions to run in older browsers, you are welcome to keep using our backwards-compatible <ViewTransitions /> component instead. You can migrate whenever you are ready. We have no plans to remove support for the <ViewTransitions /> component at this time.

What about transition:persist?

Persistent element transitions became a popular feature in Astro. The transition:persist directive told Astro to persist an element across navigation without interrupting or disrupting its state. This enabled UI like audio and video players to continue to play across pages, like in Maxi Ferreira’s music player demo.

Unfortunately, this feature is not yet supported by native cross-document navigation in the browser. Native support for persistent audio and video players may be coming in the future, but in the meantime you can continue to use our <ViewTransitions /> component if you need this additional functionality.

The Future of Astro

Using links to navigate is a foundational behavior of the web. We believe this is one of the most significant advancements to come out of Chromium and the browser spec process in recent memory. We are excited to continue partnering with Google Chrome and other browser vendors as they roll out this new API.

Developers can take advantage of native view transitions today or wait as it rolls out to more users. Whenever you’re ready to enable (or migrate) it’s essentially a one-line change of CSS to do so.

To get started, you can learn more about Astro View Transitions. We will be updating our documentation over the next few weeks to include using these new native browser APIs.