Change web page in html widget on button press


(Art Blumberg) #1

I know there has to be a way to do this, but my javascript is rusty and I have been away from Hype for a while.

I was working on a site with a large number of scenes which would be slow to load and, in order to change any part of the site, I would have to republish the entire thing. What I want to do is have an html widget on the main page that can be used to display what are now scenes. Buttons on the main page would execute a javascript that would change the web address displayed by the html widget. So far, all I have managed to do is get the http address to display as text. Can anyone clue me in on what I am missing here?

Thanks,

Art.


How to open url in html widget from symbol click
(Mark Hunte) #2

To set a new source for the widget you can run some JS which does it for you.

var  htmlWidget = hypeDocument.getElementById("render").children[0];
	 
	 
  htmlWidget.setAttribute("src", "Contact.html");

widgetSource.hype.zip (42.8 KB)


(Art Blumberg) #3

Thanks, Mark - that did the trick. Just wondering - is this information (like children[0]) documented anywhere or is it standard javascript syntax that I haven’t run across in the past?


(Mark Hunte) #4

Standaed JS

children