Search code examples
httpsgoogle-custom-search

Changing Google CSE custom search from http to https


I am using Google Custom Search box with below code

<div class="cse">
          <form action="http://www.google.com/cse" id="cse-search-box">
    <div>
      <input type="hidden" name="cx" value="xxxxxxxxxx" />
      <input type="hidden" name="ie" value="UTF-8" />
      <input type="text" name="q" size="30" />
      <input type="submit" name="sa" value="Search" />
    </div>
  </form>
  <script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script></td></p>      
        </div>    

However as now going to shift all pages to https - has to replace the code

<div class="cse">
          <form action="https://cse.google.com/cse" id="cse-search-box">
    <div>
      <input type="hidden" name="cx" value="xxxxxxxxxx" />
      <input type="hidden" name="ie" value="UTF-8" />
      <input type="text" name="q" size="30" />
      <input type="submit" name="sa" value="Search" />
    </div>
  </form>
  <script type="text/javascript" src="https://cse.google.com/cse.js?cx=' + cx/brand?form=cse-search-box&lang=en"></script></td></p>      
        </div>    

Can anyone help and assist if the above modified code is correct


Solution

  • That seems like it should work, but you should consider switching to the Custom Search Element --- It's the modern, supported way to use Google Custom Search