JavaScript 谷歌音译 API 不通过 https 提供服务。我遇到了混合内容错误。它可以在 http 网站上运行,但不能在 https 上运行。我尝试通过以下所有方式调用 API。
<script type="text/javascript" src="https://google.com/jsapi">
<script type="text/javascript" src="http://google.com/jsapi">
<script type="text/javascript" src="//google.com/jsapi">
<script type="text/javascript" src="//www.google.com/jsapi">
Error:
混合内容:页面位于 'https://extranuclear-freque.000webhostapp.com/lang.html'通过 HTTPS 加载,但请求了不安全的脚本 ''。该请求已被阻止;内容必须通过 HTTPS 提供。
请帮帮我。谢谢
<pre>
<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.BENGALI],
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>
</pre>
我找到了一种解决方案来纠正上述错误,您只需在上传服务器时粘贴以下行元标记..如果您发现这有帮助,请告诉我..
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)