Developer forum

Forum » Development » YouTube iframe disappearing

YouTube iframe disappearing

Asdis Gudmundsdottir
Asdis Gudmundsdottir
Reply

Hi there, 

We are having trouble saving youtube iframe links, whenever I update the webshop it disappears in the database and all that is left is: 

<iframe width=

Our customer is getting very frustrated having to input all the links again and again. It is stored as a custom product field as a Link. The link is not over 255 characters. 

Normal links looks like this: 

<iframe width="560" height="315" src="https://www.youtube.com/embed/2z0mZ9xtnkI" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

 

youtube2.JPG youtubelink.JPG

Replies

 
Nicolai Pedersen
Reply

Hi Asdis

Can you show a screendump in what field you insert this?

Thanks, Nicolai

 
Asdis Gudmundsdottir
Asdis Gudmundsdottir
Reply

Yes, I added it to the original post 

 
Nicolai Pedersen
Reply

Hi Asdis

Yes - you have used a link editor which expects a valid link - i.e. "http://www.google.com", "Default.aspx?ID=123", "someone@somewhere.com", "/Files/documents/manual.pdf". But it does not like nor support markup. The youtube url is valid: https://www.youtube.com/embed/2z0mZ9xtnkI - but when you wrap it in the embed code with the iframe, it will not work.

So you have 2 options

  • Keep the field as is, and have the customer paste only the youtube link "https://www.youtube.com/embed/2z0mZ9xtnkI" and then in your product template, put the link inside the iframe code
  • Create a new field "Video embed" of type "Long text" that will take the entire markup including the iframe code and render that out in your template.

Hope this clarifies.

BR Nicolai

 
Asdis Gudmundsdottir
Asdis Gudmundsdottir
Reply

Ok thank you very much.

I think I will edit the template and take only the link itself.

 

You must be logged in to post in the forum