I have an HTML widget containing an iframe for a video. If, while the video is playing, the user clicks on another button, I would like the video to stop playing. I have used this:
Hi @Daniel!
The code snippet you provided above a while back works well and we use it all the time for restarting videos within iFrames (by emptying and adding content back in). But when I tried using it to reload with results from a polling form, it doesn't work.... Not sure what I'm doing incorrectly? RealtimeResults.zip (44.0 KB)
It looks like you're trying to write a JavaScript function to be placed inside of an iframe on click, but this isn't something you can do. !
Does Wufoo not provide a regular URL for results? That would be ideal in this situation. Then you can set an HTML widget.
Alternatively, you can create a regular HTML page containing that wufoo code and upload it to your server. And you can use that HTML page as your source for an HTML widget.
If you want to reload an HTML widget, you can set a Unique Element ID for that HTML widget (something like myframe1). Make sure you're setting this on the HTML widget and not a group it is contained in.
Then run this function to reload it:
var myframe1element = hypeDocument.getElementById("myframe1").getElementsByTagName("iframe")[0];
// get the source of the current frame and reload it:
myframe1element.src = myframe1element.src
Thanks @Daniel. Wufoo doesn't provide a URL for results - has to be the embed code but I took your idea of putting the results in another HTML page and then creating an iframe to that which refreshes on button click. Works well now!