Skip to content

fix(nitro): allow navigation from error page to external protocols - #34405

Merged
danielroe merged 1 commit into
nuxt:mainfrom
adampatterson:fix-iframe-sandbox-prompt
Feb 28, 2026
Merged

danielroe merged 1 commit into
nuxt:mainfrom
adampatterson:fix-iframe-sandbox-prompt

Conversation

@adampatterson

Copy link
Copy Markdown
Contributor

🔗 Linked issue

/issues/34404

📚 Description

When nuxt-error-overlay is active, the error overlay iframe blocks navigation to external protocols due to sandbox restrictions.

Clicking on a link that triggers an external protocol (e.g., vscode:, phpstomr:, etc.) results in the following error in the browser console:

Navigation to external protocol blocked by sandbox, because it doesn't contain any of: 'allow-top-navigation-to-custom-protocols',
'allow-top-navigation-by-user-activation', 'allow-top-navigation', or 'allow-popups'. See https://chromestatus.com/feature/5680742077038592
and https://chromeenterprise.google/policies/#SandboxExternalProtocolBlockedUnderstand this error

This change adds allow-top-navigation-by-user-activation to the iframe sandbox protocols which resolves the issue.

-iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin');
+iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-top-navigation-by-user-activation');

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions Bot added 4.x 🐛 bug Something isn't working as expected labels Feb 27, 2026
@coderabbitai

coderabbitai Bot commented Feb 27, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

The change modifies the iframe sandbox attribute configuration in the development utilities file. Specifically, the sandbox attribute is updated to include allow-top-navigation-by-user-activation alongside the existing allow-scripts and allow-same-origin directives. This adjustment expands the permitted actions for sandboxed iframe navigation, allowing top-level navigation initiated by user activation. The modification involves a single line replacement with no changes to other logic or control flow.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description is directly related to the changeset, explaining the problem, the solution, and providing the exact code change made.
Title check ✅ Passed The title accurately describes the main change: adding sandbox attribute to allow user-activated navigation from the error overlay iframe to external protocols.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new

pkg-pr-new Bot commented Feb 27, 2026

Copy link
Copy Markdown

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@34405

@nuxt/nitro-server

npm i https://pkg.pr.new/@nuxt/nitro-server@34405

nuxt

npm i https://pkg.pr.new/nuxt@34405

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@34405

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@34405

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@34405

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@34405

commit: e172c7c

@codspeed

codspeed Bot commented Feb 27, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 20 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing adampatterson:fix-iframe-sandbox-prompt (e172c7c) with main (ada4e89)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@danielroe danielroe changed the title fix(nuxt): navigation to external protocol blocked by sandbox (nuxt/nitro-server) fix(nitro): allow navigation from error page to external protocols Feb 28, 2026
@danielroe
danielroe added this pull request to the merge queue Feb 28, 2026
@danielroe

Copy link
Copy Markdown
Member

thank you ❤️

Merged via the queue into nuxt:main with commit ac91f77 Feb 28, 2026
55 of 56 checks passed
@github-actions github-actions Bot mentioned this pull request Feb 26, 2026
@github-actions github-actions Bot mentioned this pull request Mar 8, 2026
This was referenced Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.x 🐛 bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants