GitHub user FrancescoCastaldi added a comment to the discussion: embed chart
In Superset 5 and 6, the `@superset-ui/embedded-sdk` is designed specifically
for full dashboards. To embed an individual chart into an external web page,
you can use the standalone Explore iframe URL.
Here are the required configuration steps in `superset_config.py` and how to
embed the chart:
### 1. Configuration in `superset_config.py`
#### Allow Framing from your External Application Domain (CSP / Talisman)
Superset uses Flask-Talisman to protect against clickjacking. You must allow
your host application's domain in the `frame-ancestors` directive:
```python
# In superset_config.py
TALISMAN_CONFIG = {
"content_security_policy": {
"frame-ancestors": [
"'self'",
"https://your-company-app.com",
"http://localhost:3000",
],
},
"force_https": False, # set True if using HTTPS
}
# If Talisman is disabled, ensure X-Frame-Options allows framing:
HTTP_HEADERS = {"X-Frame-Options": "ALLOWALL"}
```
#### Configure Public / Anonymous Access (if embedding without Superset login)
If your external users do not have a Superset login session, map the `Public`
role:
```python
PUBLIC_ROLE_LIKE = "Gamma"
```
Then navigate to **Settings -> List Roles -> Public**, and ensure it has:
- `can read on Chart`
- `datasource access on [database_name].[schema_name]` (or
`all_datasource_access`)
### 2. The Standalone Chart Embed URL
Open the chart in Explore and copy the URL. Append the `standalone` query
parameter:
```html
<iframe
src="https://your-superset-instance.com/explore/?slice_id=123&standalone=1"
width="800"
height="500"
frameborder="0"
></iframe>
```
### Standalone Parameter Modes:
- `standalone=1`: Hides the main Superset header navigation bar.
- `standalone=2`: Hides the header and control panel (pure visualization with
title).
- `standalone=3`: Hides all chrome, borders, and margins, rendering only the
pure chart canvas.
GitHub link:
https://github.com/apache/superset/discussions/42887#discussioncomment-19164778
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]