google transliterate not served over https

2,314 views
Skip to first unread message

Sean Dunn

unread,
Jan 14, 2016, 10:05:04 PM1/14/16
to Google AJAX APIs
Hello,

I'm attempting to use the google transliterate (not translate) API in a SPA. Due to certain considerations, the SPA must be served over https. When I attempt to use the api on an input element, I get the following error:

"Blocked loading mixed active content "http://www.google.com/inputtools/request?text=al-asfar&ime=transliteration_en_ar&num=5&cp=0&cs=0&ie=utf-8&oe=utf-8&app=jsapi&uv&cb=_callbacks_._0ijf27fk9"

The only fix i could think of was loading the API in the head over https by changing...

<script type="text/javascript" src="http://www.google.com/jsapi"></script>

to...

<script type="text/javascript" src="HTTPS://www.google.com/jsapi"></script>

emphasis added. But that didn't work. Even after clearing the cache.

I guess that this is hard-coded into the transliteration control object, but I’m not sure where. When I copy that "mixed active content" URL into my browser and change http to https, I get a working response. Try here:

https://www.google.com/inputtools/request?text=al-asfar&ime=transliteration_en_ar&num=5&cp=0&cs=0&ie=utf-8&oe=utf-8&app=jsapi&uv&cb=_callbacks_._0ijf27fk9

If anyone has an idea for a workaround, or something obvious that I've missed, I'd really appreciate it. The API absolutely rocks otherwise.

Thanks,

A Newbie

arun...@wiwoinc.com

unread,
Jan 21, 2016, 7:05:16 AM1/21/16
to Google AJAX APIs
Hi Sean,

I'm facing the same problem. Were you able to get a solution? I searched a lot, i tried using a API key as mentioned here : http://joethewebguy.net/2011/how-to-use-google-jsapi-on-http-or-https-pages/ but that too didn't work.

Dhanesh SR

unread,
Apr 2, 2016, 8:35:05 AM4/2/16
to Google AJAX APIs
Hi Sean,
I'm also facing this issue.. Any workarounds ???

Nitin Goyal

unread,
Oct 12, 2017, 8:53:15 PM10/12/17
to Google AJAX APIs
I download the translationI.js to my server and change the hardcore url "http://www.google.com" to "https://www.google.com" and now it working

rakesh b.k

unread,
Mar 17, 2018, 7:57:51 AM3/17/18
to Google AJAX APIs
Hi Nitin ,

I'm facing the same problem as well , when you say , you downloaded "translationI.js" to your server , how did you get it to work with the example given in google site ? , like i believe that translationI.js get's called internally rite ?

Vrahm Dev Tiwari

unread,
May 1, 2018, 7:19:31 AM5/1/18
to Google AJAX APIs
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <script type="text/javascript" src="https://www.google.com/jsapi">
    </script>
    <script type="text/javascript">
      google.load("elements", "1", {
            packages: "transliteration"
          });
      function onLoad() {
        var options = {
            sourceLanguage:
                google.elements.transliteration.LanguageCode.ENGLISH,
            destinationLanguage:
                [google.elements.transliteration.LanguageCode.HINDI],
            shortcutKey: 'ctrl+g',
            transliterationEnabled: true
        };
        var control =
            new google.elements.transliteration.TransliterationControl(options);

        control.makeTransliteratable(['transliterateTextarea']);
      }
      google.setOnLoadCallback(onLoad);
    </script>
  </head>
  <body>
    <textarea id="transliterateTextarea" style="width:600px;height:200px"></textarea>
  </body>
</html> 

Jignesh Prajapati

unread,
Sep 13, 2018, 9:29:50 AM9/13/18
to Google AJAX APIs
I have same issue can any one help on this 

jlo...@gmail.com

unread,
Dec 24, 2018, 9:49:34 PM12/24/18
to Google AJAX APIs
Assuming you are using the same minified version of transliteration.I.js as I have, add the following line after control initialization.  The code will look like:


        var control =
            new google.elements.transliteration.TransliterationControl(options);
   
        var ids = ["transl1", "transl2"];
        control.makeTransliteratable(ids);


//Add the following line to make it work over https
        control.c.qc.t13n.c[3].c.d.keyup[0].ia.F.p = 'https://www.google.com';   

That will make sure that all XHR calls to google transliteration API is done via https.

Mithilesh kumar

unread,
Feb 23, 2019, 3:17:29 PM2/23/19
to Google AJAX APIs
Reply all
Reply to author
Forward
0 new messages