0

我用谷歌翻译文本框。它的工作正常但是当我开始生产时它正在显示

“‘ https://myexample.org/ ’的页面是通过 HTTPS 加载的,但请求了不安全的脚本‘ http://www.google.com/inputtools/request?text=kamla&ime=transliteration_en_ta&num=5&cp=0&cs=0&ie =utf-8&oe=utf-8&app=jsapi&uv&cb=_callbacks_._0je9phncp '. 该请求已被阻止;"

那么如何将翻译器 url http 转换为 https,我的代码是:

<!DOCTYPE html>
   <html>
<head>
<title> Transliteration Help </title>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("elements", "1", {packages: "transliteration"});
</script> 
<style>
    .inputapi-transliterate-indic-suggestion-menu{
        z-index: 100;
    }
</style>
<script>
function OnLoad() {
 var currValue = document.getElementById("txtTranslator");                               
 var options = {
                 sourceLanguage:
                 google.elements.transliteration.LanguageCode.ENGLISH,
                destinationLanguage:
                [google.elements.transliteration.LanguageCode.TAMIL],
                shortcutKey: 'ctrl+g',
                transliterationEnabled: true
};
var control = new
google.elements.transliteration.TransliterationControl(options);
control.makeTransliteratable(["txtTranslator"]);
var postValue = document.getElementById("txtTranslator"); 

} //end onLoad function
google.setOnLoadCallback(OnLoad);
</script> 
</head>
    <body>
    <input size="40" type="text" id="txtTranslator"/>
</body>

</html>
4

1 回答 1

0

打开https://www.google.com/jsapi并将代码复制粘贴到本地。将带有 http 的 URL 更改为 https。在您的代码中包含此文件。

如果您正在使用它,也请删除此代码

/* google.load("elements", "1", { packages: "transliteration" }); */

于 2019-05-15T09:15:12.780 回答