0

<script type="text/javascript" src="http://www.google.com/jsapi">在扩展程序中不起作用。其实我是想使用谷歌API的注音键盘 这样Google API PHONETIC键盘在扩展程序中不起作用

google.load("elements", "1", {packages: "keyboard"}); 

function onLoad() { 
google.elements.keyboard.enableKeyCodeScheme(false); 
new google.elements.keyboard.Keyboard(
    [google.elements.keyboard.LayoutCode.MALAYALAM_PHONETIC], 
    ['t']); 
document.getElementById('t').focus(); 
} 
google.setOnLoadCallback(onLoad); 

manifest.json的权限似乎是罚款: - "permissions": ["tabs","http://*/*","https://*/*"],

还是安慰出现这样enter image description here

回答

0

有无阅读关于Content Security Policy的扩展。

更具体地说,你不能正常load external scripts

然而,只要剧本起源https,你可以relax the default CSP通过添加清单如下:

"content_security_policy": "script-src 'self' https://www.google.com; object-src 'self'" 

一定要改变你的脚本标签链接到https。

+0

非常感谢您的回答,这一变化我得到了另一个控制台错误** Uncaught ReferenceError:google没有定义**。这里提到的错误'google.load(“elements”,“1”,{packages:“keyboard”});' – Muhammed

相关问题