markdown API:Google:未捕获TypeError:无法读取null的属性'offsetWidth'

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown API:Google:未捕获TypeError:无法读取null的属性'offsetWidth'相关的知识,希望对你有一定的参考价值。

This problem is usually due to the map div not being rendered before the javascript runs that needs to access it.You should put your initialization code inside an onload function or at the bottom of your HTML file, just before the tag, so the DOM is completely rendered before it executes (note that the second option is more sensitive to invalid HTML).Note, as pointed out by matthewsheets this also could be cause by the div with that id not existing at all in your HTML (the pathological case of the div not being rendered)Adding code sample from wf9a5m75's post to put everything in one place:    <script type="text/javascript">        function initialize() {        var latlng = new google.maps.LatLng(-34.397, 150.644);        var myOptions = {            zoom: 8,            center: latlng,            mapTypeId: google.maps.MapTypeId.ROADMAP        };        var map = new google.maps.Map(document.getElementById("map_canvas"),                myOptions);    }    google.maps.event.addDomListener(window, "load", initialize);        </script>

以上是关于markdown API:Google:未捕获TypeError:无法读取null的属性'offsetWidth'的主要内容,如果未能解决你的问题,请参考以下文章

Google 登录 API 挂起并出现未捕获的错误无法从 URL 哈希获取父源

未捕获的异常 InvalidArgumentException,消息配置文件未按指定找到:adsapi_php.ini - Google Adwords API

PHP Youtube Data API:未捕获的异常:必须通过composer或下载完整的软件包来安装此库

Flutter Google 登录错误未被捕获

该服务目前不可用 Google api

未捕获的错误:找不到类“Google\AdsApi\Examples\AdWords\v201809\Reporting\DOMDocument”