Skip to content

fix: the play page offers a new tab or another browser where the player cannot start (#116) - #117

Merged
alekswebnet merged 2 commits into
mainfrom
fix/play-elsewhere
Nov 25, 2026
Merged

alekswebnet merged 2 commits into
mainfrom
fix/play-elsewhere

Conversation

@alekswebnet

@alekswebnet alekswebnet commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #116.

Where the player cannot start for the frame's sake or the browser's, the play page now says so and gives the way on, in place of a technical error. A content error of the activity's own is shown as before.

How the page knows, from the browser alone

  • Before anything is built: no secure context (a chat on plain http), no origin (a frame sandboxed without one), or no Service Worker at all. Nothing is built then. Not in a tab that only saves (&save=1), which needs no player.
  • After the build: the player's no-worker error (a worker that could not register, as where third-party cookies are blocked), and, framed only, bad-archive or quota. The page built that archive a moment before, so a read or store that fails is the frame's, not the package's.

What is seen (a new seventh state, elsewhere, in the stage's place, in the design of the other states)

  • Framed: an icon, "Open it in a new tab", one line on why (the chat's page not on a secure connection; the chat not letting the player start inside its reply, for a frame with no origin; or the browser not letting it, as where it blocks third-party cookies), the solid button Open in a new tab, and under it "If no tab opens, copy this address into your browser." with the address in a read-only field and Copy. A parent that opens links is handed the address (the click handler already in place for target="_blank"); elsewhere the link opens a tab where the frame lets it. The address carries the addresses the parent gave for the person's files (&links=), so the tab plays them from there, and never &save=1 (fragmentWithLinks takes save = false for it).
  • In a tab with no worker (an app's built-in browser): "Open it in another browser", why, and the address to copy into one. No button.
  • In a tab off https: "Open it on a secure connection", with the https address to copy.
  • The address is built from location.origin, which is the URL's origin even in a frame with no origin of its own (self.origin is "null" there): checked in Chromium, Firefox and WebKit.
  • Download stays where a package was built: it is the person's even where it does not play.
  • Light and dark, 760 px and 360 px wide: the text wraps in the panel, the address scrolls in its field, the button and the Copy button keep their size.

A save with no word. A parent that took the package to save and says nothing for 10 s: "Nothing saved yet? Right-click Download, or press and hold it, and open the link in a new tab." under the stage, Download pressable again. Before, "The chat is saving the .h5p…" for a minute. A yes that comes later is still said, as before.

Checked against this branch's build, the page served from 127.0.0.1 and a stand-in chat from localhost (another site, so the frame is third-party, as in a chat), the stand-in saying it opens links:

Case Before Now The tab the chat opens
Chromium, defaults plays plays –
Chrome, "Block third-party cookies" (real Chrome profile) "Could not register …" Open it in a new tab plays
Firefox, third-party cookies refused (cookieBehavior 1) "Could not register …" Open it in a new tab plays
Firefox, defaults plays plays –
WebKit (Playwright's), framed by another site "Could not read the archive index" Open it in a new tab plays
Frame sandboxed without an origin the technical no-Service-Worker error Open it in a new tab, at once –
Parent on plain http (chat.test) "It could not be built…" Open it in a new tab, at once plays
Tab with no Service Worker the technical error Open it in another browser –
Tab that only saves (&save=1), no Service Worker – builds and downloads the .h5p –
The page itself on plain http (site.test) "It could not be built…" Open it on a secure connection, the https address –
Parent that saves and never answers "saving…" a minute the way by hand at 10 s –

pnpm typecheck and pnpm build pass. cubic's review: four points fixed in 0764266 (the save-only tab, the two wordings, the name placeholders); the fifth, location.origin in a frame with no origin, answered with the three engines' values. Not tried: Safari itself, iOS in-app browsers, the real chats' frames.

Paired with missing-elements/h5p-toolkit#276, the card's and the server's fallbacks; neither needs the other.


Summary by cubic

Fixes the play page so that when the player cannot start inside a chat's frame or the browser, it explains why and offers a new tab or another browser with a copyable address, instead of a technical error. A save the chat never confirms now says how to save by hand after 10 seconds instead of waiting a minute.

  • The page tells why before anything is built (no secure context, no origin, no Service Worker) or from the player's no-worker error, and a framed bad-archive or quota error.
  • The offered tab's address carries the file links the parent gave, without &save=1, so it plays from there; on plain http the address is rewritten to https.
  • The check is skipped in a tab that only saves, which builds and downloads with no player.
  • A frame sandboxed without an origin and a tab off https get wording of their own.
  • The activity's name placeholder is not shown beside the way on.
  • Download stays where a package was built, even when it does not play.

Written for commit 0764266. Summary will update on new commits.

View guided diff Turn on auto-fix

…the play page offers a new tab or another browser, and a save with no word says the way by hand after 10 s (#116)

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread src/h5p/play/play-page.ts Resolved
Comment thread src/h5p/play/play-page.ts Resolved
Comment thread src/h5p/play/play-page.ts Resolved
Comment thread src/assets/site.css Resolved
Comment thread src/h5p/play/play-page.ts Resolved
…eed; a frame with no origin and a tab off https get words of their own; no name placeholders beside the way on (#116)

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 2 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/h5p/play/play-page.ts">

<violation number="1" location="src/h5p/play/play-page.ts:257">
P2: Apply the https rewrite only for `insecure`. Right now it runs for every reason, so a `kept` tab on http://localhost gets an https address that a plain-http dev server does not serve. A framed `insecure` page skips the rewrite, so the address it offers stays http and will not play, although the text says it plays in a tab of its own.</violation>

<violation number="2" location="src/h5p/play/play-page.ts:268">
P3: The phrase "as where it blocks third-party cookies" is unclear. Use "as it does where it blocks third-party cookies".</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread src/h5p/play/play-page.ts
// The address's own origin, which is the page's URL's even in a frame with no origin of its own
// (`self.origin` is "null" there, `location.origin` is not: Chromium, Firefox and WebKit,
// 2026-11-25). A tab of its own off https is sent to https, where the player starts.
const origin = framed ? location.origin : location.origin.replace(/^http:/, 'https:')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Apply the https rewrite only for insecure. Right now it runs for every reason, so a kept tab on http://localhost gets an https address that a plain-http dev server does not serve. A framed insecure page skips the rewrite, so the address it offers stays http and will not play, although the text says it plays in a tab of its own.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/h5p/play/play-page.ts, line 257:

<comment>Apply the https rewrite only for `insecure`. Right now it runs for every reason, so a `kept` tab on http://localhost gets an https address that a plain-http dev server does not serve. A framed `insecure` page skips the rewrite, so the address it offers stays http and will not play, although the text says it plays in a tab of its own.</comment>

<file context>
@@ -248,17 +251,27 @@ function cannotStart(): Why | null {
+  // The address's own origin, which is the page's URL's even in a frame with no origin of its own
+  // (`self.origin` is "null" there, `location.origin` is not: Chromium, Firefox and WebKit,
+  // 2026-11-25). A tab of its own off https is sent to https, where the player starts.
+  const origin = framed ? location.origin : location.origin.replace(/^http:/, 'https:')
+  const address = `${origin}${location.pathname}${Object.keys(given).length ? fragmentWithLinks(ownFragment, given, false) : ownFragment}`
   elsewhereAddress.value = address
</file context>
Suggested change
const origin = framed ? location.origin : location.origin.replace(/^http:/, 'https:')
const origin = why === 'insecure' ? location.origin.replace(/^http:/, 'https:') : location.origin

Comment thread src/h5p/play/play-page.ts
elsewhereText.textContent = {
insecure: 'This chat’s page is not on a secure connection, and the player starts only on one. In a tab of its own it plays, still built in your browser.',
sandboxed: 'This chat does not let the player start inside its reply. In a tab of its own it plays, still built in your browser.',
kept: 'Your browser does not let the player start inside this chat’s reply, as where it blocks third-party cookies. In a tab of its own it plays, still built in your browser.'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The phrase "as where it blocks third-party cookies" is unclear. Use "as it does where it blocks third-party cookies".

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/h5p/play/play-page.ts, line 268:

<comment>The phrase "as where it blocks third-party cookies" is unclear. Use "as it does where it blocks third-party cookies".</comment>

<file context>
@@ -248,17 +251,27 @@ function cannotStart(): Why | null {
+    elsewhereText.textContent = {
+      insecure: 'This chat’s page is not on a secure connection, and the player starts only on one. In a tab of its own it plays, still built in your browser.',
+      sandboxed: 'This chat does not let the player start inside its reply. In a tab of its own it plays, still built in your browser.',
+      kept: 'Your browser does not let the player start inside this chat’s reply, as where it blocks third-party cookies. In a tab of its own it plays, still built in your browser.'
+    }[why]
     elsewhereNote.textContent = 'If no tab opens, copy this address into your browser.'
</file context>
Suggested change
kept: 'Your browser does not let the player start inside this chat’s reply, as where it blocks third-party cookies. In a tab of its own it plays, still built in your browser.'
kept: 'Your browser does not let the player start inside this chat’s reply, as it does where it blocks third-party cookies. In a tab of its own it plays, still built in your browser.'

@alekswebnet
alekswebnet merged commit 9fc0c99 into main Nov 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The play page in a chat: a way on where the browser keeps the player from starting

1 participant