title: javascript / jquery - google custom search api - functions triggering twice
body: <p>I'm using the code from the google search API along with my own jquery function to do a simple log to the console, and I noticed the jquery functions are being triggered twice. In addition, javascript errors are being thrown (this happens even on Google's example page). </p>
  
  <p>Here's my code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          google.load('search', '1', {language : 'en'});
          google.setOnLoadCallback(function() {
              var customSearchControl = new google.search.CustomSearchControl('000638822871137547098:_xxgiq7wt_k');
              var linkTarget = "frame";
              //customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
              //customSearchControl.draw('cse');
  
              // Use "mysite_" as a unique ID to override the default rendering.
              google.search.Csedr.addOverride("mysite_");
              customSearchControl.setLinkTarget(linkTarget)
              // Draw the Custom Search Control in the div named "CSE"
              customSearchControl.draw('cse');
  
              $('.gsc-search-button').click(function(){
                  console.log('click');
              })
  
              // Execute an initial search
              //customSearchControl.execute("ajax");
  
  
          }, true);
      &lt;/script&gt;
  </code></pre>
  
  <p>and here's the javascript error that occurs:</p>
  
  <pre><code>Unsafe JavaScript attempt to access frame with URL about:blank from frame with URL http://www.google.com/cse?q=x&amp;client=google-coop&amp;hl=en&amp;r=s&amp;cx=000638822871137547098%3A_xxgiq7wt_k&amp;oe=UTF-8&amp;ie=UTF-8&amp;format=n4&amp;ad=n0&amp;adsafe=high&amp;nocache=1319551264502&amp;fexp=20606&amp;num=0&amp;safe=off&amp;output=uds_ads_only&amp;source=gcsc&amp;v=3&amp;adext=as1%2Csr1&amp;rurl=http%3A%2F%2Flocalhost%3A8888%2F#slave-1-1. Domains, protocols and ports must match.
  </code></pre>
  
  <p>Lastly, here's the example from google code:</p>
  
  <p><a href="http://code.google.com/apis/customsearch/docs/js/rendering.html#_intro_CSC" rel="nofollow">http://code.google.com/apis/customsearch/docs/js/rendering.html#_intro_CSC</a></p>
  
  <p>How do I resolve these errors and fix the double click issue?</p>