试图让google可视化API在greasemonkey(firefox)中工作我试图使用:
// @require http://www.google.com/jsapi
然后我收到错误:google.visualization未定义
添加后:
// google.load('visualization', '1', {packages: ['table']});
我收到错误:$未定义
我是否要求做错事?请帮忙。提前感谢有用的答案!
答案 0 :(得分:1)
我有一个关于Google Maps API的类似问题。
在我的情况下,我必须使用
将API附加到页面API_js_callback = "http://maps.google.com/maps/api/js?sensor=false®ion=BR&callback=initialize";
var script = document.createElement('script');
script.src = API_js_callback;
var head = document.getElementsByTagName("head")[0];
(head || document.body).appendChild(script);
并且google
必须被称为unsafeWindow.google
,所以我也添加了google = unsafeWindow.google
。
initialize = setTimeout(function () {
google = unsafeWindow.google;
directionsService = new google.maps.DirectionsService();
directionsDisplay = new google.maps.DirectionsRenderer();
.
.
.
点击此处查看完整代码和说明:how to use the google maps api with greasemonkey to read a table of addresses and trace the route?