HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
WICG
portals
HTML2019–2023
WICG / portals

portals

A proposal for enabling seamless navigations between sites or pages

16Distinct people
21Mentions
0Explicit recommenders
948GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A proposal for enabling seamless navigations between sites or pages

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year21 dated mentions

Observed mentions: 2019-05-10 14:27:10 UTC to 2023-09-26 22:03:10 UTC.

0369122019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 8 mentions; 0 submissions, 8 comments20192020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 12 mentions; 1 submissions, 11 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20212022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC808
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC12111
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC000
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC000
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC101

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
The Portals proposal is not currently being actively pursued. Many of the capabilities that Portals would have enabled are being explored in other proposals: navigation speculation (including speculation rules, prefetch, and prerendering) View Transitions Fenced Frame and more (which may be added here) This repository is thus effectively archived for the time being. Portals Portals enable seamless and instant navigations between pages. In particular, we propose a new <portal> HTML element which enables a page to show another page as an inset, and then activate it to perform a seamless transition to a new state, where the formerly-inset page becomes the top-level document. Portals are part of a general effort toward privacy-conscious, well-specified prerendering. They go beyond basic prerendering support by also providing the inset preview of the content. This makes them suitable for seamless navigations, not just instant ones; for example, they enable web-developer-controlled navigation transitions between the referring page and the prerendered page. Their inset form also can serve as a more-private and more-secure form of an iframe, in certain cases. Table of contents Examples Introductory example Navigation transitions Use cases Objectives Details Same-origin communication channels Rendering Interactivity Accessibility Session history, navigation, and bfcache Activation CSP integration Embedder-imposed policies and delegation Summary of differences between portals and iframes Alternatives considered A new attribute on an existing element TODO: Security and privacy considerations Stakeholder feedback Acknowledgments Examples Introductory example A document can include a <portal> element, which prerenders the specified URL in the portal: <portal id="myPortal" src="https://example.com/"></portal> This prerenders https://example.com/ in a prerendering browsing context, which imposes certain restrictions such as no use of permission-requiring APIs, or no access to storage in the cross-origin case. Importantly, cross-origin content will need to opt in to such prerendering. But unlike other prerendering technologies, where the prerendering takes place entirely offscreen, the portal element shows a preview of the prerendered content. In this way it is somewhat like an iframe, providing a rendered view of another page. Note, however, that a portal's preview is much more restricted than the general embedding mechanism iframes provide; e.g., user interaction with does not pass through to the portaled content. When the portaled content is same-origin, the embedding page can communicate with it using myPortal.postMessage(data); This can be useful to coordinate the preview displayed. However, when the portaled content is cross-origin, postMessage() does not function, so as to prevent cross-site tracking. While all prerendered content can be activated, becoming fully-rendered top-level content, portals expose this ability to web developers directly. That is, while other prerendering technologies rely on the browser to implicitly activate the prerendered content, with portals the web developer can call myPortal.activate(); which causes the embedding window to navigate, replacing its document with the prerendered one. At this point, the user will observe that their browser has navigated to https://example.com/, e.g., via changes to the URL bar contents and back/forward UI. Since https://example.com/ was already loaded and prerendered in the portal context, this navigation will occur seamlessly and instantly, without a network round-trip or document re-initialization. For more advanced use cases, the https://example.com/ document can react to activation, using the portalactivate event. It can use this event to adapt itself to its new context. For example, if the page was only showing preview content while in a portal, it can switch to showing the full content of the page. The page can also adopt its predecessor (the document which previously occupied the tab) into a new portal context. window.addEventListener('portalactivate', e => { document.body.classList.add('displayed-fully'); document.requestStorageAccess().then(() => { document.getElementById('user').textContent = localStorage.getItem('current-user'); }); let predecessor = e.adoptPredecessor(document); console.assert(predecessor instanceof HTMLPortalElement); document.body.appendChild(predecessor); }); If https://example.com/ does not need to adapt portal-specific content when activated and does not need the predecessor-adoption capability, then it can instead use the generic APIs for reacting to prerendering activation or other relevant changes, outlined in that explainer. Navigation transitions As a more realistic example, consider a page which wants to prerender a link and provide a seamless navigation transition when it's clicked. It can do this by hiding the portal until the link is clicked, and then animating the portal to full screen before activation. This might be written like so: <a href="https://example.com/" class="seamless">Click me!</a> <script> for (const link of document.querySelectorAll('a.seamless')) { const portal = document.createElement('portal'); portal.src = link.href; portal.hidden = true; portal.style = 'position: fixed; top: 0; left: 0; width: 10vw; height: 10vh;'; document.body.append(portal); link.onclick = async e => { if (portal.state === 'empty') { // The content couldn't be portaled, likely because it didn't opt-in. // Let the normal link click go through. return; } e.preventDefault(); // Show the portal, and animate it to the whole viewport over 300 milliseconds. if (!matchMedia('(prefers-reduced-motion: reduce)').matches) { portal.hidden = false; await portal.animate([{ width: '100vw', height: '100vh' }], { duration: 300 }).finished; } // Once the preview is now displayed as the whole viewport, activate.
Read the full README on GitHub

What Hacker News says

21 sources
I see from the list of issues that "about:blank cannot host a portal"[0] (and in fact the parent page has to be served over HTTP/HTTPS). Does that mean that it's impossible to have a bookmarklet with a data URI that defines a page with a portal in it? It would be really nice if the trick described in [1] could be combined with portals to allow a user to bookmark a fixed bundle of code for a web app, to defend against a malicious server sending different JavaScript on different visits or to different visitors. This would probably also require that the SRI spec be extended to work with portals, so that the contents of a portal could be guaranteed to match a specified hash. Are there any plans for that? [0] https://github.com/WICG/portals/issues/214#issuecomment-6477... [1] https://news.ycombinator.com/item?id=17776456
In Portals API
Note that postMessage is only allowed same-origin, for privacy reasons (to avoid cross-site tracking). Portals are entirely new browsing contexts, so just as "heavy" as iframes. Iframes are generally not that heavy though (especially compared to modern JS frameworks); I'd encourage you to experiment to see how well portals might work for your use cases. Allowing hosts to inform the styling of portaled pages is a communications channel, so we don't want to allow that directly (since it makes cross-site tracking easier). That said, a page can tell via JavaScript (by testing `window.portalHost`) whether it's being portaled, and we think it's probably a good idea to extend this to CSS. See https://github.com/WICG/portals/issues/3 . This is one noisy bit, so it shouldn't cause tracking concerns.
In Portals API
Chrome team member here, and one of the people working on the portals spec. This isn't accurate. This feature is being developed behind a flag, as it's still highly experimental and undergoing a lot of change. There is an origin trial [1] for mobile-only same-origin-only portals [2] which people can use to test how well this works in the wild, but it's nowhere near shipping. You can learn more about the intention of the element in [3]. [1]: https://github.com/GoogleChrome/OriginTrials/blob/gh-pages/d... [2]: https://developers.chrome.com/origintrials/#/view_trial/-768... [3]: https://github.com/WICG/portals/blob/master/README.md
In Portals API
Found some context: https://github.com/WICG/portals I think this proposal is a better starting point for readers than an API spec. Goals, taken directly from the proposal: - Enable seamless navigations from a page showing a portal, to the portaled page - Enable seamless navigations between pages of a portal-aware website - Avoid the characteristics of iframes which have negative impacts on security, privacy, and performance Also: https://github.com/WICG/portals#summary-of-differences-betwe...
In Portals API
from the explainer [0]: Portals enable seamless navigations between pages. In particular, we propose a new <portal> HTML element which enables a page to show another page as an inset, and then activate it to perform a seamless transition to a new state, where the formerly-inset page becomes the top-level document. Portals encompass some of the use cases that iframes currently do, but with better security, privacy, and ergonomics properties. And via the activation operation, they enable new use cases like preloading or navigation transitions. [0]: https://github.com/WICG/portals#readme
In Portals API
If portals really were iframes, there would be no reason to create them. Google is completely open about their intentions. Citation from https://github.com/WICG/portals/blob/master/key-scenarios.md: > After being activated, a portal opened by the news aggregator will now receive the input events. This means that it will have to co-operate with the news aggregator in order to maintain the desired user experience. Why exactly does it _have_ to cooperate? And _how_ can it cooperate? Will it be enough to include a script from parent domain? Will analytics be part of "desired user experience"? Will parent domain ban a site from it's index for trying to "break out"? It is essentially impossible to build relationships of mutual trust to the point when one website can freely embed another... unless one party has overwhelming power advantage. Who
Read the rest
is the target auditory of <portal>? What "news aggregator" has enough leverage to make pages switch back to it as told to? If such "aggregator" existed, I would not trust it to make web browsers or dictate, how they should work.
In Google launches new “portal” HTML element

Showing the 15 most recent of 21 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.