Skip to content

"Single Tab Page" meta tag #11322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
yuval-a opened this issue May 20, 2025 · 1 comment
Open

"Single Tab Page" meta tag #11322

yuval-a opened this issue May 20, 2025 · 1 comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest

Comments

@yuval-a
Copy link

yuval-a commented May 20, 2025

What problem are you trying to solve?

Some web apps are designed to only be allowed to run on one tab (per browser window, or per browser), e.g.: "WhatsApp Web".
The common behavior for these apps is, if the url/path of the app is already opened/loaded/browsed to in a tab, and a user browses to the same url/path - a modal dialog will be displayed, informing them that the app can only run in a single tab, usually with buttons that allow to either close the new tab, or close the old tab and make the new tab the "singleton tab".

I believe this is common enough to be implemented in the browser levels - e.g. with a <meta> HTML tag in the <head> of the page. Another reason is, this is a behavioral UX/UI issue on the "browser level" - similar to how ` contains "rendering instructions" for the browser.

What solutions exist today?

The "old way" was using a value stored in LocalStorage , and a check if a value already exists - this is limited and prone to errors, because:

  • There is no reliable clean-up mechanism. (unload is obolete, pagehide is unreliable).
  • Some browsers sandbox LocalStorage per tab in "private mode" (e.g. Safari).

Modern apps use BroadcastChannel, which is reliable - but if this feature is implemented, the overhead of using it just for this can be avoided.

How would you solve it?

Option 1: single behavior

a Meta tag: <meta name="single-tab" content="true"> or <meta name="single-tab" content="*.example.com, *.example2.com"> (with comma-separated list of urls) will signal the browser that that page should not be allowed to be opened in other tabs- the browser will show the modal alert upon opening in another tab - giving the option to close others or cancel the new tab.

Option 2: multiple behavior options

<meta name="single-tab-urls" value="*.example.com, *.example1.com" />
<meta name="single-tab-policy">
with optional values such as:

  • allow-multiple: Default browser behavior
  • warn-on-duplicate: Show a modal if the page is opened again in another tab (with options to close others, or close the new tab).
  • block-duplicate: Prevent rendering on new tabs, show a warning and close tab.

Maybe a value that specifies the page should only be allowed in a single tab across all Browser window instances.

Anything else?

No response

@yuval-a yuval-a added addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest labels May 20, 2025
@tabatkins
Copy link
Contributor

I'd oppose this simply on the notion that "you can only open this in one tab" is virtually always an anti-pattern and completely unnecessary.

Additionally, tho, this meta wouldn't actually solve the issue anyway. A user could open the same URL in multiple browsers, or on multiple devices, and a single browser instance tracking the meta won't do anything to solve that. This is something that needs to be handled at the server level, tracking sessions, not at the client level. (And if you can track sessions, you can handle multiple tabs...)

So, I'm fine with the rare cases that actually do need this having to continue doing something a little complicated to handle it, since it means that cases that don't actually need it are discouraged from doing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest
Development

No branches or pull requests

2 participants