我的 Google 自定义搜索一直卡在加载中。我在 Chrome 控制台中得到的 JS 错误是:
Uncaught TypeError: Object [object Object] has no method 'enableSearchBoxOnly'
我的代码:
<div class="search">
<div id='cse-search-form' style='width: 100%;'>Loading</div>
</div>
<script src='//www.google.com/jsapi' type='text/javascript'></script>
<script type='text/javascript'>
google.load('search', '1', {language: 'es', style: google.loader.themes.DEFAULT});
google.setOnLoadCallback(function() {
var customSearchOptions = {};
var customSearchControl = new google.search.CustomSearchControl('003806993800906102968:1a2oqwxzgqk', customSearchOptions);
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
var options = new google.search.DrawOptions();
options.enableSearchBoxOnly('https://www.globalsign.es/buscar', 'q');
customSearchControl.draw('cse-search-form', options);
}, true);
</script>
提前感谢您的帮助!