Skip to content

feat: embededded browse page to create new visualizations - #2599

Merged
Kronmar-Bafu merged 4 commits into
mainfrom
feat/embededded-browse-page
Aug 4, 2026
Merged

feat: embededded browse page to create new visualizations#2599
Kronmar-Bafu merged 4 commits into
mainfrom
feat/embededded-browse-page

Conversation

@mburri

@mburri mburri commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

The embedded visualisation on OpenData.swiss stopped working after we implemented more restrictive CSP policies.
Example page: https://opendata.swiss/de/dataset/programmstruktur-von-radioprogrammen-der-srg.

An analysis showed that opendata.swiss pages embed '/browse' pages. This was not anticipated when the stricter CSP policies were implemented. We expected only published visualisations to be embedded on third-party sites.
It also turned out that this was intentional and part of a broader feature designed some time ago. Instead of including the whole application, only a reduced 'browse' page should have been included using the URL parameter 'odsiframe=true'.
This would render a page with the basic dataset and a 'Create a Visualisation' button that opens the application in a new tab. Unfortunately, this change was not completely implemented, and will probably not be added to opendata.swiss soon.

This PR now addresses these issues.

  • The CSP header for /browse now allows *.admin.ch and *.opendata.swiss as frame-ancestors. This enables these pages to be embedded in an iframe.
  • The /browse page now detects whether it is embedded in an iframe and uses the reduced layout if necessary.

This implements the odsiframe parameter without setting the parameter in the URL.
The drawback is that this only works on the client, whereas the 'odsiframe' parameter would also work on the server. As the page is rendered on the server, switching from the complete to the reduced layout only occurs after the page has been sent to the client, resulting in brief visible flickering.

@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
visualization-tool Ready Ready Preview Aug 4, 2026 6:41am

Request Review

@mburri
mburri requested a review from Kronmar-Bafu August 3, 2026 09:56
@mburri
mburri requested a review from hupf August 4, 2026 06:35

@Kronmar-Bafu Kronmar-Bafu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

workable solution to the existing problem

@Kronmar-Bafu
Kronmar-Bafu merged commit b54b746 into main Aug 4, 2026
6 of 7 checks passed
@Kronmar-Bafu
Kronmar-Bafu deleted the feat/embededded-browse-page branch August 4, 2026 06:41
const isEmbedded = useIsEmbedded();
return (
<AppLayout hideHeader={hideHeader}>
<AppLayout hideHeader={hideHeader || isEmbedded}>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is suboptimal, that part of this is evaluated on the server and part of it on the client and we can't use the actual useOdsIframe hook here... but I guess it is what how it is...

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.

3 participants