Javascript Error and GET Request Refusal from Google Custom Search

I ran into a problem with the Google Custom Search Engine embedded in my site. I have other Google elements on the same page, such as the +1 button and the G + icon, but I have highlighted and verified that the search element is essentially the culprit.

The problem is this: the GET request for http://www.google.com/uds/api/ads/3.0/9f53ed6be164615d919d9e4bd4f7fe8d/search.I.js seems unsuccessful (although the search on the site continues). The Chrome Developer Console says the request is initiated by their jsapi on line 21 and has the following highlighted in red:

google.(anonymous function).d (anonymous function) 

I have tried several test scripts, including pasting a search box into a fully bubbly HTML page, but I get the same error. What causes a request failure? Is it just something at their end (and therefore not fixed)?

Edit: Relevant code

This is all taken verbatim from the Google code generators.

This happens right before </head>

 <script> (function() { var cx = '004344714102800561193:mo5u_njahwy'; var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//www.google.com/cse/cse.js?cx=' + cx; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); })(); </script> 

Search Box Code:

 <gcse:searchbox-only></gcse:searchbox-only> 

Search Results Page Code:

 <gcse:searchresults-only></gcse:searchresults-only> 
+4
source share
1 answer

Do you have an ad blocker installed as Adblock Plus? I get this error when I run your code in JSFiddle:

Failed to load resource: net :: ERR_BLOCKED_BY_CLIENT

This error appears to be often caused by an ad blocker that prevents the download of the file: Meta. What are these errors in the Chrome console when visiting StackOverflow?

+1
source

Source: https://habr.com/ru/post/1436911/


All Articles