How do I make links open in another tab using p5js not html?

In html it would be target="_blank" but I need to do it in p5js. Here is my pretty code:


//https://github.com/CodingTrain/Rainbow-Code/blob/master/Tutorials/P5JS/p5.js/8.3_p5.js_what_is_JSON_pt2/birds.json

var data;

function preload() {
  data = loadJSON("birds.json");
}

function setup() {
  noCanvas();
  
  for (var i = 0; i < data.birds.length; i++) {
    createElement('h1', data.birds[i].family);
    for (var j = 0; j < data.birds[i].members.length; j++) {
      var url = 'https://en.wikipedia.org/wiki/';
      url += data.birds[i].members[j];
      createA(url, data.birds[i].members[j]);
      createP('');
    }
  }
}

Answers

Sign In or Register to comment.