title: Clicking a leaflet marker takes you to URL
body: <h2>Within the leaflet package for R, is there a way to click on a marker, and be directed to a URL?*</h2>
  
  <p>Here's the <a href="https://gis.stackexchange.com/questions/77132/go-to-the-url-when-clicked-on-leaflet-marker">JS solution</a>. </p>
  
  <p><br></p>
  
  <p>In R, to add a Popup with a URL:</p>
  
  <pre><code>library(leaflet)
  content &lt;- paste(sep = "&lt;br/&gt;",
                   "&lt;b&gt;&lt;a href='http://www.samurainoodle.com'&gt;Samurai Noodle&lt;/a&gt;&lt;/b&gt;"
  )
  
  leaflet() %&gt;% addTiles() %&gt;%
    addPopups(-122.327298, 47.597131,  content,
               options = popupOptions(closeButton = FALSE)
    )
  </code></pre>
  
  <p>It's also straightforward to add a Marker that, when clicked, provides a URL in the popup: </p>
  
  <pre><code>leaflet() %&gt;% addTiles() %&gt;%
    addMarkers(-122.327298, 47.597131, popup =  content,
              options = popupOptions(closeButton = FALSE)
    )
  </code></pre>
  
  <p>Perhaps something custom passed to leaflet in <code>...</code>?<br>
  <br></p>
  
  <hr>
  
  <p>Lastly, how could a custom JS function display different URLs for each map marker? Consider the example data.frame:  </p>
  
  <pre><code>df &lt;- data.frame(url = c("https://stackoverflow.com/questions/tagged/python",
                           "https://stackoverflow.com/questions/tagged/r")),
                   lng = c(-122.327298, -122.337298),
                   lat = c(47.597131,47.587131))
  </code></pre>
  
  <hr>
  
  <p>*This was <a href="https://stackoverflow.com/questions/36293855/rleaflet-hyperlink-on-click/36294036#comment102798541_36294036">previously asked</a>, but I'm asking the question again here and making a minimal, reproducible example.  </p>