Link to home
Start Free TrialLog in
Avatar of BothWorldsJo
BothWorldsJoFlag for United States of America

asked on

Google Custom Search Results Returned in IFrame Not Working in SSL webpage?

Hi!
I have a website where I recently added Google's custom search engine.  The results are returned in an IFrame. If it returns to a secure page, it errors in IE and Firefox.  If it's an unsecure page, no problem.  To test, enter classes in the second Google searchbox -
https://shopping.classregistrar.com/CVSFSearchadv.aspx
http://shopping.classregistrar.com/CVSFSearchadv.aspx
Any ideas how to get it to resolve cleanly? Can I rewrite their javascript, maybe hold it locally?
This is their insert on the return results page -
<script type="text/javascript">
var googleSearchIframeName = "cse-search-results";
var googleSearchFormName = "cse-search-box";
var googleSearchFrameWidth = 600;
var googleSearchDomain = "www.google.com";
var googleSearchPath = "/cse";</script>
<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>
Thanks,
Jo
Avatar of Informer9
Informer9
Flag of Poland image

I cant see a problem there.

What exactly is the error you get.

Describe some steps to get this error.

Best

Mike
Avatar of BothWorldsJo

ASKER

With the https link, IE prompts that there is unsecure content.  In Firefox, the secure padlock is not closed.  It's the IFrame html code that's generated by Google - it includes http:, rather than https: links in the returned text, which doesn't work within the main https secured page.
Jo
I have been dealing with this issue since CSE went live.  The easiest
 solution i've found is how www.printa.com implemented the code.  In
 fact, im going to do the same on www.bottleyourbrand.com.
 
I emailed customer support and just received a reply back from
 Google.  Here's what they stated.
 --------------------------------------------------------------------------------------------------
 Hi Scott-
 
Currently there is no way to get download the javascript using HTTPS
 from google's website.
 
i.e, if you're using the iframe
 http://www.google.com/afsonline/show_afs_search.js  will work but
 https://www.google.com/afsonline/show_afs_search.js  wont.
 
One workaround you could try that involves a bit of coding is to proxy
 the search query on your website.
 
That is, you could write a .php or .jsp page which collects the search
 query from the user and submits a URL like the following to get the
 raw XML coming back:  In the example below, its a query for q=brand
 
http://www.google.com/cse?cx=010375552319769440266:adtz_wjhhmw&ie=UTF...
 
Once you have the raw xml, you could write an xslt to transform it to
 anything/anyformat you chose.
 http://www.google.com/coop/docs/cse/resultsxml.html
 
The other way is to proxy the javascript call from the browser to your
 webserver as https and you retrieve the show_afs_search.js script on
 your own.  The problem with that is we may change the javascript on
 the google.com servers at anytime and if our .js page as local URL
 references, it will break completely.
 
The easiest way I'm aware of is doing the XML transforms.
 
There is a feature request to support https and we've submitted it to
 engineering as issue #829046.
 
Best regards,
 
Google Enterprise Support
I have been dealing with this issue since CSE went live.  The easiest
 solution i've found is how www.printa.com implemented the code.  In
 fact, im going to do the same on www.bottleyourbrand.com.
 
I emailed customer support and just received a reply back from
 Google.  Here's what they stated.
 --------------------------------------------------------------------------------------------------
 Hi Scott-
 
Currently there is no way to get download the javascript using HTTPS
 from google's website.
 
i.e, if you're using the iframe
 http://www.google.com/afsonline/show_afs_search.js  will work but
 https://www.google.com/afsonline/show_afs_search.js  wont.
 
One workaround you could try that involves a bit of coding is to proxy
 the search query on your website.
 
That is, you could write a .php or .jsp page which collects the search
 query from the user and submits a URL like the following to get the
 raw XML coming back:  In the example below, its a query for q=brand
 
http://www.google.com/cse?cx=010375552319769440266:adtz_wjhhmw&ie=UTF...
 
Once you have the raw xml, you could write an xslt to transform it to
 anything/anyformat you chose.
 http://www.google.com/coop/docs/cse/resultsxml.html
 
The other way is to proxy the javascript call from the browser to your
 webserver as https and you retrieve the show_afs_search.js script on
 your own.  The problem with that is we may change the javascript on
 the google.com servers at anytime and if our .js page as local URL
 references, it will break completely.
 
The easiest way I'm aware of is doing the XML transforms.
 
There is a feature request to support https and we've submitted it to
 engineering as issue #829046.
 
Best regards,
 Google Enterprise Support


You could read full support article here

http://groups.google.com/group/google-custom-search-cse-and-your-site/browse_thread/thread/b06fc51e3ac168bc


Good Luck

Michael
ASKER CERTIFIED SOLUTION
Avatar of Informer9
Informer9
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the reference to the XSLT.  I may end up with the outside page, although the code so far is within a template.ascx which makes it a bit more painful.  You would think with all their resources, they would publish 2 js for ssl and non ssl...

Thanks again,
Jo