Search code examples
htmlsearch-enginegoogle-custom-search

Google Custom Search Engine taking a long time to load on webpage?


I set up a custom search engine with google through www.google.com/cse/

I am testing it out on my website in Chrome, on my machine, and the webpage is loading fine, but the CSE takes upwards of 45 seconds to load. When it does load, it works perfectly fine.

Has anyone encountered this issue?

I try in Firefox and it loads immediately, no problems. In IE9, it has:

Internet Explorer has restricted this webpage from running scripts or ActiveX controls.

With an enable option available.

Could this be an ActiveX problem with Chrome?


Solution

  • This appears to be a bug with the Google AJAX APIs (or the CSE generator), as far as I can tell. I have found a workaround to get the custom search to load quickly in Chrome:

    Assuming that you haven't modifed the code you received from www.google.com/cse/, change:

    google.load('search', '1', {language : 'en', style : google.loader.themes.V2_DEFAULT});
    

    to:

    google.load('search', '1', {language : 'en'});
    

    For some strange reason the style setting causes the long/infinite load times in Chrome.