7

Is there a way to get the script for search results from an HTTPS site instead of http://www.google.com/afsonline/show_afs_search.js

I am using the custom google business search on a HTTPS site. When search is submitted web browser shows warning:

"This page contains both secure and nonsecure items"

I tried to modify the source to be https://www.google.com/afsonline/show_afs_search.js but that doesn't work. Still JavaScript returned from that link connects to http links instead of https links.

Does anybody knows how to fix this ?

John Conde
  • 207,509
  • 96
  • 428
  • 469
Dominik Szopa
  • 1,769
  • 1
  • 13
  • 16
  • 1
    I had the same problem and ended up looking to see if the pages was "https" and if it was, I removed the site search option so it wouldn't bring up the notice. It would come on whenever someone was in our "shopping" area and I figured it was better to show nothing than to have the message come up and scare them away. My code is embedded into the main page source. Not sure if an iFrame would yeild different results... good luck. I'll check back to see if there's ever a solution. – Don Oct 25 '10 at 20:42

3 Answers3

9

A hack that works for me is to provide a modified version of the script

https://www.google.com/afsonline/show_afs_search.js

on another server, say:

https://www.myserver.com/show_afs_search.js

Just copy the original scripts source code and replace 'http' with 'https' in the script (one occurrence). Of course that might stop working anytime if Google changes something.

ibi
  • 106
  • 1
  • 2
  • that's a clever hack indeed, but what about monetization? If I modify and download the script, will google adsense continue to provide revenues? – GrafiCode Mar 09 '17 at 11:56
4

Even if you modify the Javascript link to HTTPS, show_afs_search.js is still hardcoded to get the search results via HTTP, not HTTPS. To avoid this error, make your own copy of show_afs_search.js that grabs results via HTTPS.

Steps:

  1. download show_afs_search.js
  2. open the file and replace 'http' with 'https'
  3. put this file one your https server and use it
ManuPK
  • 10,995
  • 9
  • 54
  • 75
Mark Lu
  • 1,188
  • 1
  • 11
  • 18
0

Just change the one instance of http to https.

Ali Afshar
  • 38,455
  • 12
  • 89
  • 108