Enable the google search script to function in an SSL site without the insecure content error message

This forum is for questions about contributing to the project or proposing features that you would like to develop for the project. 

This thread is closed to new posts. You must sign in to post in the forums.
8/11/2011 1:38:32 PM
Gravatar
Total Posts 19

Enable the google search script to function in an SSL site without the insecure content error message

Hi Joe,

This is the first time I have posted a contribution, so I'm not sure if this is the right area?  Anyhow, here is a modification to mojoPortal.Web.Controls\google\LocationMap.cs (428) which enables the google search script to function in an SSL site without the insecure content error message.

private void SetupSearchScript()
        {
            string protocol = "http";
            if (Page.Request.IsSecureConnection) { protocol = "https"; }

           
            Page.ClientScript.RegisterClientScriptBlock(
                typeof(GMapBasePanel),
                "guds", "\n<script type=\"text/javascript\" src=\""
                + protocol
                + "://www.google.com/uds/api?file=uds.js&amp;v=1.0"
                + "\" ></script>");

            Page.ClientScript.RegisterClientScriptBlock(
                typeof(GMapBasePanel),
                "gudslocal", "\n<script type=\"text/javascript\" src=\""
                + protocol
                + "://www.google.com/uds/solutions/localsearch/gmlocalsearch.js"
                + "\" ></script>");

        }

Let me know if this gets included in a future update ;-)

Regards,
Sonny

8/11/2011 1:55:16 PM
Gravatar
Total Posts 18444

Re: Enable the google search script to function in an SSL site without the insecure content error message

Hi Sonny,

Thanks! This change is now in the repository.

fyi, I recommend instead of using that one use mojoPortal.Web.UI.LocationMap.cs which is in Web/Controls

so <portal:LocationMap rather than <goog:LocationMap

I've kept the old one for backward compatibility but recommend to use the newer one.

I made the same change in the newer mojoPortal.UI.LocationMap.cs except one small difference:

if (SiteUtils.IsSecureRequest()) { protocol = "https"; }

Whereas Page.Request.IsSecureConnection can give a false even for a secure request if proxying through a load balancer where the ssl cert is on the load balancer and not on the web site, so this SiteUtils method does some extra checks against some configurable server variables to allow detecting a secure connection in some alternate ways.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.