Iframe how to accept cookies

Hi, I need help with iframe. Is it possible to accept cookies from an external website using an Grafana/visualization/text/iframe?

I would like to show weather forecast on one dashboard that I use in playlist…

This code shows webpage but I cannot accept cookies.

’ <iframe
’ src=“https://www.ilmatieteenlaitos.fi/saa/pori?forecast=short
’ frameborder=“0”
’ height=“800”
’ width=“1500”
’ >

I tried data-cookieblock-src= / data-cookieconsent=“marketing” but neither of these worked. The website keeps asking me to accept cookies…

What kind of error is in the browser console?

Hi,

console says Cookie “FMI_COOKIE_CONSENT” has been rejected because it is in a cross-site context and its “SameSite” is “Lax” or “Strict”. Attached is picture.

So that’s a reason.

Hi, thanks for your reply. Is there any workaround for this? I tried to modify grafana.ini file without success.

I added this and restarted grafana-server.

set cookie SameSite attribute. defaults to lax. can be set to “lax”, “strict”, “none” and “disabled”

cookie_samesite = none

And I added this configuration to the visualization, but still got the same error

'<iframe
’ src=“https://www.ilmatieteenlaitos.fi/saa/pori?forecast=short
’ data-cookieconsent=“marketing”
’ frameborder=“0”
’ allowfullscreen
’ height=“800”
’ width=“1500”
'>

That will not help you, because this is to configure samesite for cookies from your Grafana.

But FMI_COOKIE_CONSENT is not Grafana’s cookie. It is cookie from https://www.ilmatieteenlaitos.fi, so https://www.ilmatieteenlaitos.fi admin must configure SameSite=None, … on their side and then you won’t have this when you load https://www.ilmatieteenlaitos.fi in the iframe.

You can sacrifice this security feature - check your browser doc if you can disable it.

You can live with this security feature, but you must be sure that iframed content is from the same domain as your Grafana and it has that samesite/secure attributes - you must deploy/install/configure/maintain some proxy for that.

Thanks. So how does the browser feature of the Grafana panel work? Does it use the user’s browser for iframe or does it have a built-in browser like Chromium?

user’s browser for iframe

1 Like