https google maps不显示,该如何处理

https google maps不显示如果不使用https,程序可以正常跑起来,但是使用了https,就报脚本错误了,说:Error:

https google maps不显示
如果不使用https,程序可以正常跑起来,但是使用了https,就报脚本错误了,说:Error: 'google' is undefined

代码如下:
var directionsDisplay = new google.maps.DirectionsRenderer();

[解决办法]
要使用google要先定义啊,
var google;