I need a tutorial for how to embed YouTube videos in CartoDB Editor infowindows.

Most help I can find about this is about iframes which were apparently disabled for security reasons.

What do I have to do, step by step, to make an infowindow display a YouTube video in CartoDB Editor?

What is the HTML code I have to put in the infowindow section of the CartoDB web interface?

Is this possible without hosting the map on my own server? How do I access the .js script if I am using the CartoDB Editor web interface?

This, from the aforementioned link, does not work:

<div class="cartodb-popup">
  <a href="#close" class="cartodb-popup-close-button close">x</a>
  <div class="cartodb-popup-content-wrapper">
     <iframe width="188" src="{{youtube_embed_link}}" frameborder="0" allowfullscreen></iframe>
  <div class="cartodb-popup-tip-container"></div>

1 Answer 1


CartoDB disables < script > and < iframe > tags on infowindows due to security reasons. However, you could still disable this, by using the sanitizeTemplate:falseoption when declaring an infowindow, like this: sublayer.infowindow.set({ template: $('#infowindow_template').html(), width: 218, maxHeight: 100, sanitizeTemplate:false }); You can check that out on the documentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.