1

I am embedding my CartoDb as follows

$('#map').ready(function(e){
    cartodb.createVis('map', '//internetadventureclub.cartodb.com/api/v2/viz/617ba774-fd8c-11e4-9e57-0e4fddd5de28/viz.json', {https: true});
  });

How can i enable sanitizeTemplate:false in the above so that the YouTube Video can be played in the infowindow of CartoDB

1 Answer 1

2

Here you have an example of sanitization by using createViz:

 cartodb.createVis('map', 'viz.json', { description: true, search: true, shareable: true })
      .on('done', function(vis,layers) {

        var layer = layers[1].getSubLayer(0);
        //layer.infowindow.set('template', $('#infowindow_template').html());
        layer.infowindow.set('sanitizeTemplate', 'false');

        layer.on('error', function(err) {
          console.log('error: ' + err);
        });

      }).on('error', function() {
        console.log("some error occurred");
      });
2
  • this cant be done from inside the the cartoDB app?
    – Harsha M V
    Nov 19, 2015 at 5:06
  • Nope. Inside the CartoDB Editor you cannot generate your own scripts neither embed external sites as this is quite insecure for the users of the platform and the viewers of the maps.
    – iriberri
    Nov 20, 2015 at 9:39

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.