>我为文本框使用了谷歌翻译。 它的工作除外,但是当我转移到生产环境时,它显示
"'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"。 此请求已被阻止;">
那么如何将翻译网址 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>
打开 https://www.google.com/jsapi 并将代码复制到本地粘贴。将带有 http 的网址更改为 https。在代码中包含此文件。
如果您正在使用此代码,请同时删除它
/* google.load("elements", "1", { 包:"音译" }); */