URL in choropleth map

Based on Etienne’s solution related to click events Click events in maps, the following should work to open a URL by clicking on a country in a map:

Plotly.newPlot('graph', [{
  type: 'choropleth',
  locations: ['CAN', 'USA', 'RUS'],
  z: [10,20,30]
}])
.then(gd => {
  gd.on('plotly_click', d => {
    var pt = (d.points || [])[0]

    switch(pt.location) {
      case 'CAN':
        window.open("https://www.somedomain1.com","_self")
        break
      case 'USA':
        window.open("https://www.somedomain2.com","_self")
        break
    }
  })
})

This would not display the URL, but it would redirect when country is clicked, which can still be useful in some cases.