我使用谷歌翻译器进行文本框。它作为例外工作,但当我转移到生产它显示
"' 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&#39 ;. 此请求已被阻止;"
所以如何将翻译网址 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>
答案 0 :(得分:0)
打开https://www.google.com/jsapi,然后将代码复制粘贴到本地。 将带有http的URL更改为https。将此文件包含在您的代码中。
如果正在使用此代码,也请删除它
/ * google.load(“ elements”,“ 1”,{ 包:“音译” }); * /