I'd like to include an anchor tag in a Folium Marker popup so that I can click through to another page.

Here's my code:

    def poptext(row):
        return "<a href=\"" + row['Feed']  + "\">" + row['Name'] + "</a>"

    map = folium.Map(location=[52.620,-0.264], zoom_start=14)

    df.apply(lambda row: folium.Marker([row['Lat'], row['Lon']],popup=poptext(row)).add_to(map), axis =1)


Unfortunately, the HTML doesn't seem to be evaluated. Any solution?

4 Answers 4


You should check the Folium version you are using. 0.2.0 has changed how popups are added, as explained in this issue thread: https://github.com/python-visualization/folium/issues/360

Popups now no longer take html automatically but rather one must pass in a folium.element.IFrame of the html.

This notebook shows the differences in folium 0.2.0: http://nbviewer.jupyter.org/github/bibmartin/folium/blob/issue288/examples/Popups.ipynb

And, the code would look something like this (found in the notebook above):

m = folium.Map([43,-100], zoom_start=4)

    <h1> This is a big popup</h1><br>
    With a few lines of code...
        from numpy import *<br>
iframe = folium.element.IFrame(html=html, width=500, height=300)
popup = folium.Popup(iframe, max_width=2650)

folium.Marker([30,-100], popup=popup).add_to(m)


NB: The way to create markers, therefore, is no longer simple_marker or circle_marker, but rather folium.Marker or folium.CircleMarker().

The docs have also been (recently?) put up.


You can embed arbitrary HTML using folium.Html, with script=True. Here is a minimal example which demonstrates this:

import folium

m = folium.Map([51.5, -0.25], zoom_start=10)

test = folium.Html('<b>Hello world</b>', script=True)

popup = folium.Popup(test, max_width=2650)
    location=[51.5, -0.25], popup=popup,


Without script=True, the string passed to folium.Html is escaped and so the HTML markup is visible in the marker popup.

This is documented in the branca examples page. I was using Folium 0.3.0.

  • This is out of date for folium 0.5.0
    – Michael K
    Oct 14, 2017 at 16:15
  • @MichaelK, I'm on folium 0.7.0 and it works just fine.
    – KlausCPH
    Dec 2, 2018 at 12:50

Try changing the location, URL, and popup text you want.

import folium
f = folium.Figure(width=1000, height=1000)
m=folium.Map([39.067758, -94.573534], zoom_start=25).add_to(f)
pp= folium.Html('<a href="'+ 'give your url here'+'"target="_blank">'+ 'popup text' + '</a>', script=True)
popup = folium.Popup(pp, max_width=2650)
folium.Marker(location=[39.067758, -94.573534], popup=popup).add_to(m)


The interesting thing is that the iframe solution popup = folium.Popup(iframe) works for a pop up, but not for a tooltip:

html = """<b>your HTML text here</b><br>etc."""
iframe = folium.IFrame(html=html, width=200, height=100)
folium.Marker(location=[37, -99.09], popup=folium.Popup(iframe)) # popup will render html correctly

However, substituting popup and Popup from the code above by tooltip and Tooltip, respectively, doesn't work. To make it work, use render() method:

folium.Marker(location=[37, -99.09], tooltip=folium.Tooltip(iframe.render())) # without the render method, a blank tooltip will appear.

Your Answer

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

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