Dynamic change webview url

2,219 views
Skip to first unread message

Renato Riolino

unread,
Oct 18, 2013, 3:40:02 PM10/18/13
to ope...@googlegroups.com
Is it possible to dynamic change webview url?

I have a setup where I use a Selection on my sitemap to choose my TV current source (Antenna, Satellite, Bluray or XBMC).

What I want is create a rule to change a webview URL to point to the url of the remote control of the selected device. I tried to define a global string and set url=globalString but didn't work.

Thanks.

Kai Kreuzer

unread,
Oct 19, 2013, 2:47:35 AM10/19/13
to ope...@googlegroups.com
Hi,

No, this is currently not possible.
We have a similar request for image widgets, see https://code.google.com/p/openhab/issues/detail?id=310.

Regards,
Kai

--
You received this message because you are subscribed to the Google Groups "openhab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at http://groups.google.com/group/openhab.
For more options, visit https://groups.google.com/groups/opt_out.

Chris Jackson

unread,
Oct 20, 2013, 10:58:52 AM10/20/13
to ope...@googlegroups.com
It will probably be possible to do what you want with the changes I've made to the sitemap system - this should be available in the next day or two.

It won't be changeable through a rule, but within the sitemap you can specify different URLs depending on the state of an item. I think this is effectively what you want?

Chris

Greg

unread,
Oct 20, 2013, 11:32:00 AM10/20/13
to ope...@googlegroups.com

Hi Chris.
Can the image be the url taken from a String item, not just mapped in the sitemap?
In the squeezebox binding, there is an item that is a string if the album art url.  Would be nice to be able to show that as an image.

Greg

Chris Jackson

unread,
Oct 20, 2013, 11:54:47 AM10/20/13
to ope...@googlegroups.com

Hi Greg,

I'll take a look - it should be easy enough, but I'll reserve judgement until I've had another look at the proxy.

 

Cheers

Chris
 

--

renato.n...@gmail.com

unread,
Oct 20, 2013, 3:52:04 PM10/20/13
to ope...@googlegroups.com
Yes, that will work perfectly!

Thanks!

Vlad

unread,
Nov 5, 2013, 10:10:41 AM11/5/13
to ope...@googlegroups.com
Kai,

I implemented same by having a binding save remote images locally under the same name and then using Image item with refresh, BUT Image item is served with with inline style of "width:90%" which stretches the image making everything look ugly. Under GreenT ui the same item is served as "width:100%"

Is there an easy way to override this behavior? 

Regards,
Vlad

Greg

unread,
Jan 22, 2014, 7:19:42 PM1/22/14
to ope...@googlegroups.com
+1 for this feature again.
I've been playing with the mqttitude binding and was able to get the lat and long into google maps (https://maps.google.com/?q=xx.xxx,xx.xxx), which I'd like to show in my sitemap with webview.

Dan

unread,
Jan 28, 2014, 3:15:26 PM1/28/14
to ope...@googlegroups.com
Greg I'm was doing the same thing today, which is how I stumbled on this thread.  I have the mqtt binding parsing the mqttitude json payload through a JavaScript transform which returns a google maps URL.   +1 for either tying an item's string value to a webview's url, or being able to update a webview's url property dynamically.

Chris Jackson

unread,
Jan 28, 2014, 3:20:20 PM1/28/14
to ope...@googlegroups.com
I implemented this when I wrote the dynamic sitemap stuff, but it wasn’t merged as it was considered to be a security issue. The issue is that (in theory) someone could send a REST command to set your item to a URL inside your network, and then use that to access the network. I know there’s probably other security that could protect that, but that was the decision with this feature…


Dan

unread,
Jan 28, 2014, 3:29:26 PM1/28/14
to ope...@googlegroups.com
Was this for images and the web view, or just images?  I can see the security pov, but I'm not sure how you could exploit the weview since its not proxied and you can not retrieve the contents (that I know of). 

By the way thanks so much for the sitemap work you did, the use of colors is a huge help when you have large list of items.

Chris Jackson

unread,
Jan 28, 2014, 3:34:30 PM1/28/14
to ope...@googlegroups.com
It was for everything. I don’t think the proxy has any security to restrict access to specific urls, so I don’t think that helps. Maybe there’s a case for adding security as a way of resolving the issue (?).

Dan Cunningham

unread,
Jan 28, 2014, 3:41:19 PM1/28/14
to ope...@googlegroups.com
Gotcha, I assumed incorrectly then that the webview didn't use a proxy.  It would be nice to have this feature, but disabled by default.  I have everything running under SSL and requiring a username and password, so I would be OK with the risk.  I could see how a default install with no security might have a issue.   There are so many use cases for this, I think its an important feature.  

From: "Chris Jackson" <ch...@cd-jackson.com>
To: ope...@googlegroups.com
Sent: Tuesday, January 28, 2014 1:34:30 PM
Subject: Re: [openhab] Re: Dynamic change webview url

Chris Jackson

unread,
Jan 28, 2014, 3:45:56 PM1/28/14
to ope...@googlegroups.com
If I remember correctly, everything goes through the proxy to avoid cross domain issues.  I agree there’s certainly a call for this sort of feature if it can be secured.

Karel Goderis

unread,
Jan 29, 2014, 5:55:07 AM1/29/14
to ope...@googlegroups.com
Maybe you want to publish this as an example on the Wiki? 

Would save me, and probably others, a lot of pain trying to achieve the same....

Tx
K

Dan

unread,
Jan 29, 2014, 9:47:40 AM1/29/14
to ope...@googlegroups.com
Sure.

In the mean time, this is what i did. In my items I have a MQTT line for my phone

String Map_Dan_Phone {mqtt="<[home:mqttitude/daniel/iphone5s:state:JS(mqttitude-maps.js)]"}

The transform is a javascript file in the configuration/Transform directory (mqttitude-maps.js).  This file is very simple:

var location = eval('(' + input + ')');

result = "http://maps.google.com/maps?z=12&t=m&q=loc:" + location.lat + "+" + location.lon;

JS transforms use the keywords "input" and "result" fyi.   


Dan

unread,
Jan 29, 2014, 10:37:09 AM1/29/14
to ope...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages