I am building a base in which I want to put embed code for movies from external vshare.io servers. I want the content of the database and films to be presented on item dynamic page. But I can not connect the HTML element (frame) with the contents of the database in which the embed code is. How to do it?
example embed code:
<iframe src="//vshare.io/v/9g94t0q/width-470/height-305/" width="470" height="305" frameborder="0" scrolling="no" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>
Hey
Create a field for videoUrl as text and put the //vshare.io/v/9g94t0q/width-470/height-305/ inside that field and then add the iframe component to your dynamic page and using code like
let currentItem = $w("#dataset1").getCurrentItem(); $w("#iframeComponent").src = currentItem.videoUrl;
Or, you could take the whole html code and store it inside a text field and then insert that chunk into a html component.
Or, you could make a standard html code snippet which will listen for the dynamic page video fields and send those from Wix Code using the postMessage of the HTML Component and then inside the html code snippet you use the onMessage and get the event.data which could consist of the video url and then load the contents of it.
I think I'm doing something wrong. I do not know about coding
@Thomas Kopinski Hey, you get an error because you are referring to #iframeComponent in your code and the name of that component is not that I guess. Click the grey iframe and then look in the properties panel what the id is for that component.
@Andreas Kviby You're right. I changed it but still does not display the movie on the dynamic page
@Andreas Kviby Thank you for professional and quick help. Thanks to you, I can generate amazing movie bases.
how to do that I have not yet
help me
This is an old post and will be closed. If you have further questions please open up a new thread with your own problem/issue.
Bumping up old posts is against the Community Guidelines.