Skip to content

Prevent image caching in leaflet popup? #1214

@maragard

Description

@maragard

Copied from SO

So I have a Python web service that creates maps with Folium/Leaflet.js. Each plotted point is a marker with a custom popup:

folium.Marker(
            location=(row['lat'], row['lng']),
            icon=folium.Icon(color=color_mapper[type]),
            popup=folium.Popup(f'<p>{info_str} taken at {row["time"]} <br> \
                                    Description: {row["description"]}</p> \
                                    <img src={row["photoURL"]} width=300 height=500>'),
                tooltip=info_str
)

As of now when the generated HTML file is opened, any images in the popup will be loaded alongside the tilesets and plotted points. This has led to extremely slow loading times and excessive charges on each image loading call for each map. I there a way to override the popup's default behavior and only load the image when the popup is opened?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementFeature request or idea about how to make folium better

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions