Problem
The gateway serves web container content inside a sandboxed iframe with allow-scripts allow-forms allow-popups (no allow-top-navigation, no allow-same-origin). This works for single-page apps (like River) where all routing happens in JavaScript, but breaks multi-page static websites where links navigate between HTML pages.
When a user clicks a link like <a href="/v1/contract/web/KEY/news/">, the navigation is silently blocked by the sandbox. Neither regular link clicks nor window.location.href assignments work.
Impact
Static websites published with fdev website publish render correctly on the first page load, but internal navigation between pages doesn't work. This significantly limits the usefulness of the website hosting feature for multi-page sites (which is most static sites).
Current workaround
Users must navigate by editing the URL directly in the browser address bar. This is unusable for non-technical visitors.
Possible solutions
- Add
allow-same-origin to the sandbox -- simplest but may have security implications that need evaluation
- Gateway-side navigation interception -- the
freenetBridge script could listen for postMessage navigation requests from the iframe and update the iframe's src
- Rewrite links at serve time -- the gateway could inject JavaScript into served pages that intercepts clicks and communicates with the bridge via
postMessage
Option 2 seems most promising -- the iframe posts a {type: 'navigate', href: '/news/'} message, and the bridge updates the iframe src accordingly. This preserves the sandbox security model while enabling navigation.
[AI-assisted - Claude]
Problem
The gateway serves web container content inside a sandboxed iframe with
allow-scripts allow-forms allow-popups(noallow-top-navigation, noallow-same-origin). This works for single-page apps (like River) where all routing happens in JavaScript, but breaks multi-page static websites where links navigate between HTML pages.When a user clicks a link like
<a href="/v1/contract/web/KEY/news/">, the navigation is silently blocked by the sandbox. Neither regular link clicks norwindow.location.hrefassignments work.Impact
Static websites published with
fdev website publishrender correctly on the first page load, but internal navigation between pages doesn't work. This significantly limits the usefulness of the website hosting feature for multi-page sites (which is most static sites).Current workaround
Users must navigate by editing the URL directly in the browser address bar. This is unusable for non-technical visitors.
Possible solutions
allow-same-originto the sandbox -- simplest but may have security implications that need evaluationfreenetBridgescript could listen forpostMessagenavigation requests from the iframe and update the iframe'ssrcpostMessageOption 2 seems most promising -- the iframe posts a
{type: 'navigate', href: '/news/'}message, and the bridge updates the iframe src accordingly. This preserves the sandbox security model while enabling navigation.[AI-assisted - Claude]