Closed bergie closed 2 years ago
It sounds like Freeboard cannot access localStorage where it stores its configuration so it starts with default values.
This is likely due to a violation of "Same origin Policy" blocking access to LocalStorage. "Two URLs have the same origin if the protocol, port (if specified), and host are the same for both."
If you have control over the page that hosts the iframe
then try adding the following attribute:
<iframe href="....." sandbox="allow-scripts allow-same-origin">
This worked in my tests.
If this doesn't help I have also seen this happen in later versions of Chrome when "Block third-party cookies" is selected in Chrome settings.
Might want to try changing the setting to "allow all cookies" or " Block third party cookies in Incognito" and this may allow Freeboard to access it's config.
Providing parameters in the start url is only going to mask the real issue and there will be other config (like units selection, etc) which will not be available to Freeboard.
BTW: that is a nice wide screen! .
This browser is running in kiosk mode, so inability to use localStorage is more of a feature than a bug in this case. That’s why I was wondering if it’d be possible to instead feed Freeboard default initialisation values via URL parameters.
Another useful option could be storing/fetching these settings server-side. Would be nice to not have to run each client through the setup wizard again
Another useful option could be storing/fetching these settings server-side. Would be nice to not have to run each client through the setup wizard again
Freeboard already does this... Once you login (using the Login option in the Freeboard menu) it loads / saves config to the server.
This browser is running in kiosk mode, so inability to use localStorage is more of a feature than a bug in this case. That’s why I was wondering if it’d be possible to instead feed Freeboard default initialisation values via URL parameters.
Does Kiosk Mode limit access to LocalStorage? I thought it just launches an app in "Single App mode" so no other controls are available. It should not impact app operation.
If kiosk mode is persisting localStorage in a folder that is purged during an OS restart maybe trying the following to start kiosk mode may help.
/usr/lib/chromium-browser/chromium-browser --kiosk --user-data-dir=/myprofilefolder/
FYI: I have just tried chromium kiosk mode on my Rpi to launch Freeboard and it launches and retrieves persisted settings without an issue restoring selected settings, map position and zoom.
chromium-browser --kiosk http://localhost:3000/@signalk/freeboard-sk
Yup, I just went through the source code of https://github.com/grafana/grafana-kiosk
It does indeed create a temp directory for Chromium user data, and nukes it afterwards. So not much chance in persistent storage here.
But ok, switching from grafana-kiosk to just starting Chromium on my own seems to do it. I think URL params would be nice, but for now considering this fixed. Thanks!
@bergie url parameters for zoom, movemap, northup are included in v1.20.0. Documented in help.
That's great, thanks! This means I can easily build contextual dashboards. For example, zooming very close when state is anchored so that the anchor watch circle is visible
I'm running Freeboard embedded in a Grafana dashboard on a kiosk screen in our nav station
Problem is that every time the screen starts we:
Would be great to provide default values for those via URL parameters when opening the app. Then I could easily encode those to the iframe URL. For the moment I need to connect a mouse to the device to get to the desired view.