Skip to content

Conversation

@apatil
Copy link
Contributor

@apatil apatil commented Mar 12, 2015

Hi folium devs,

This PR makes it easier to embed folium widgets in pages that are served over https.

Thanks!

@ocefpaf
Copy link
Member

ocefpaf commented Mar 12, 2015

@apatil Thanks. Great work! I am a little swamped with work and cannot fully review/test this. But I will do ASAP.

Meanwhile, can you confirm if you have to add a "certificate exception" when using this? My PR (#84) suffered from this and I believe it was on of the cloud flare URLs. If not you will close my and use yours 😉

@apatil
Copy link
Contributor Author

apatil commented Mar 12, 2015

HI @ocefpaf, do you mean that when you go to something like https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.3/d3.min.js in your browser, it doesn't want to accept the certificate? I haven't seen that on Chrome or Firefox on Linux, at least.

@ocefpaf
Copy link
Member

ocefpaf commented Mar 12, 2015

I was using this one:

https://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js

cloudflare's URLs are fine here too. I think it is OK to merge, let me just tests this and I will hit the button. Thanks again for the awesome PR.

ocefpaf added a commit that referenced this pull request Mar 12, 2015
Loading javascript assets over https where appropriate
@ocefpaf ocefpaf merged commit dbd7d48 into python-visualization:master Mar 12, 2015
@ocefpaf
Copy link
Member

ocefpaf commented Mar 12, 2015

@apatil Just tested and it works just fine. Thanks again!

@psychemedia
Copy link

If protocols aren't specified, eg <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>, then if you save a map to an HTML file, eg using the common IPython notebook pattern:

def embed_map(map, path="map.html"):
    """
    Embeds a linked iframe to the map into the IPython notebook.
    """
    map.create_map(path=path)
    return HTML('<iframe src="files/{path}" style="width: 100%; height: 510px; border: none"></iframe>'.format(path=path))

and try to view the map.html just "as a file" in a browser, it will load as something like:

file:///PATH/map.html

and break, because eg file://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js does not exist?

For folk who don't run local webservers and using folium in an IPython notebook to generate standalone map files, and who want to share maps as standalone HTML files with other folk who don't run/have access to local webservers (i.e. folk who just want to double click on a file to open it), this is something of a blocker?

@ocefpaf
Copy link
Member

ocefpaf commented Apr 10, 2015

This issue has re-surfaced a lot lately.

The design was to always serve (and python simple http can help with
thay). But maybe it is time to rethink this and hardcode a HTTPS scheme.
I will start playing with this idea and check its viability.
Em 10/04/2015 08:08, "Tony Hirst" notifications@github.com escreveu:

If protocols aren't specified, eg <script src="// maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>,
then if you save a map to an HTML file, eg using the common pattern:

def embed_map(map, path="map.html"):
"""
Embeds a linked iframe to the map into the IPython notebook.
"""
map.create_map(path=path)
return HTML('<iframe src="files/{path}" style="width: 100%; height: 510px; border: none"></iframe>'.format(path=path))

and try to view the map.html just "as a file" in a browser, it will load
as something like:

file:///PATH/map.html

and break, because eg file://
maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js does not
exist?

For folk who don;t run local webservers using folium to generate
standalone map files, and who want to share maps as standalone HTML files
with other folk who don't run/have access to local webservers (i.e. folk
who just want to double click on a file to open it), this is something of a
blocker?


Reply to this email directly or view it on GitHub
#93 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants