Marc M
Marc M

Reputation: 93

Display Google Map in extension popup

I'd like to display (and work with) a Google Maps API map in an extension popup. I added https://maps.googleapis.com and https://maps.gstatic.com/ to the content_security_policy, but apparently Maps uses inline evals (!) so this just throws errors.

I also tried to create a map page in my extension and pull it in as an iframe but it appears the Maps API detects that and just shows an image.

Any hints how to get a Google Maps API map to show in a popup?

Upvotes: 3

Views: 663

Answers (3)

Marc M
Marc M

Reputation: 93

Google has released a sandboxing mechanism for dealing with "unsafe" JS. See it here: http://code.google.com/chrome/extensions/trunk/sandboxingEval.html

It works in Chrome Beta and at least in earlier coding seems to cover what I need.

Kinda sad you need to sandbox Google's own code, but there it is.

Upvotes: 1

JJ Apps
JJ Apps

Reputation: 1

Even i'm facing the same issue. My chrome extension was mainly based on google maps. I had functionality to show different kind of location with custom markers and it was going to be released in next few weeks. Now this has been a major blocker....

Upvotes: 0

Udbhav
Udbhav

Reputation: 220

We are facing the same issue. Here's what we found out.

If you are using manifest version 2, this issue cannot be fixed. See Bug raised at google maps api issues: Bug 4201

To solve this in our app, we are still using manifest version 1, and adding 'unsafe-eval' in script-src in the Content security policy string.

Upvotes: 1

Related Questions