从Chrome扩展加载Places API库

Load Places API library from Chrome Extension

本文关键字:API Places 加载 Chrome 扩展      更新时间:2023-09-26

我正在编写一个Chrome扩展,将谷歌地图自动完成添加到谷歌日历的新活动位置输入中。我试图在扩展上下文中加载库,但它阻止了说[blocked] The page at domain.com ran insecure content from anotherdomain.com

当然,我已经在manfest.json的"permissions"键中添加了http://anotherdomain.com。为了加载实际的place库,我只是从http://maps.googleapis.com/maps/api/js?libraries=places&sensor=true下载了它,因为我不知道如何将它直接添加到扩展中。

到目前为止,这似乎是不可能的,所以我只使用了JSON API和jQuery UI的自动完成。以下是我琐碎的实现https://gist.github.com/3623683