Google custom search over https

lauren.fraser's Avatar

lauren.fraser

20 Aug, 2015 03:56 PM

A while back, Cascade helped us implement google custom search. We've now switched our site to https and I'm not getting search results or getting an unsecure content message.

I've tracked down the issue to the javascript code used to pull in an iframe.

<div id="cse-search-results"></div>
<script type="text/javascript">// <![CDATA[
var googleSearchIframeName = "cse-search-results";
  var googleSearchFormName = "cse-search-box";
  var googleSearchFrameWidth = 450;
  var googleSearchDomain = "www.google.com";
  var googleSearchPath = "/cse";
// ]]></script>

That outputs this code on the live site (https://www.citizensmemorial.com) :

<iframe name="googleSearchFrame" src="http://www.google.com/cse?cx=013812141742686073830%3Apauerwbdb1k&amp;cof=FORID%3A9%3BNB%3A1&amp;ie=UTF-8&amp;q=test&amp;sa=Go&amp;ad=n9&amp;num=10&amp;rurl=https%3A%2F%2Fwww.citizensmemorial.com%2Fcmh-search-results.html%3Fcx%3D013812141742686073830%253Apauerwbdb1k%26cof%3DFORID%253A9%253BNB%253A1%26ie%3DUTF-8%26q%3Dtest%26sa%3DGo" frameborder="0" width="450" height="1860" marginwidth="0" marginheight="0" hspace="0" vspace="0" allowtransparency="true" scrolling="no"></iframe>

I'm not sure what I need to edit to change the src on the iframe to https. Any ideas?
Thanks,
Lauren

  1. 1 Posted by Ryan Griffith on 21 Aug, 2015 03:46 PM

    Ryan Griffith's Avatar

    Hi Lauren,

    Unfortunately, since this is not a Cascade issue I might not be of much help; however, with some searching, it appears this is a known issue with Google's custom search. The problem being their JavaScript file may be loaded over SSL but the <iframe> it generates dynamically has a hard coded http:// in the source. Seems like the solution is to download their JavaScript file locally and modify it to use https:// instead.

    As a side note, it looks like you are using the deprecated Custom Search v1, have you considered the newer Custom Search v2?

  2. 2 Posted by lauren.fraser on 21 Aug, 2015 09:34 PM

    lauren.fraser's Avatar

    Ryan,
    Thanks. That did the trick. We’re working on our new site and a new search engine, so I just used the fix you linked to below. I’d looked at some other search results, but didn’t click on the one you linked to.
    Thanks!
    Lauren

  3. 3 Posted by Ryan Griffith on 24 Aug, 2015 12:55 PM

    Ryan Griffith's Avatar

    Thank you for following up, Lauren, I am glad to hear the workaround did the trick.

    I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open.

    Have a great day!

  4. Ryan Griffith closed this discussion on 24 Aug, 2015 12:55 PM.

Discussions are closed to public comments.
If you need help with Cascade CMS please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

 

26 Aug, 2016 01:19 PM
25 Aug, 2016 03:02 PM
25 Aug, 2016 12:50 PM
24 Aug, 2016 08:43 PM
24 Aug, 2016 07:20 PM
21 Aug, 2016 01:20 PM