BasicUI image caching (webview svg)

I dont really see the need of autorefresh for webview.
So you are getting wrong impression of what we are discussing.

I’m just pointing out some kind of question how to pass content of the Item (eg. number) to the actual sitemap, so any browser out there will understand that there is different content because of random number/name or whatever.

So ask here is. Is there a way in OH4 how to construct output of the BasicUI from

someItemValue = 1234sdk
webview url=something?someItemValue

into

<html>
<div><iframe url=something?1234sdk</iframe></div>
</html>

as this is actually all what’s needed to stop any content being cached by any browser

Try create a mainui page and insert here your svg and load this page instead…
and keep your mainui page reloading…
Maybe this approach will work

By item, I was thinking you were talking about openHAB item, I understand now that it is not the case.
So you just want browser to avoid using cache when opening a sitemap page containing a Webview element.
This could be achieved in Basic UI (and in other sitemap UIs) like for Image and Chart elements by adding automatically a timestamp parameter to the user provided URL when building the iframe.
I am just not sure it would not break some Webview URLs that do not expect such a parameter ?
One option would then be to add a new parameter “avoidCache” to the Webview element. If present, the timestamp parameter is added to the URL by the WEB UI.

I did, but for me it’s pretty much same if it will be OH item or something else.

Question still the same, is that achievable from within sitemap file or I need to hack webview html template somehow?

Not possible without implementing something in Basic UI.

alright, so maybe better solution will be convert generated svg to png and use image element and refresh, I’ll test that if that will work and we’ll see

alright, simple change in the python to change generate png fron svg to be able to use image instead of webview and then refresh, works just fine.

No need to hack anything :wink:

Thanks for your time

Image element also accepts SVG file.

does it really? I’ve tried that and seems not for me

			Frame {
				//Webview url="/static/shadow.svg?{{itemValue('Sun_Randomizer')}}" icon="none"

				Image url="https://oh.local/static/shadow.png" refresh=60000
				Image url="https://oh.local/static/shadow.svg" refresh=60000

look like this

image

Image with svg is not rendered correctly, it’s rendered with 0x0 px … not really sure why

nevermind … changed properties in the svg, and now it’s fine.
Always learning :slight_smile:

And note that you don’t need to use the refresh parameter except if you really want to get a cyclic refresh.

1 Like