我现在正在花几个小时搜索如何在 Chrome 扩展中使用 Google API。我想做的就是解析网站的内容并将其作为新事件插入到 Google 日历中。我得到了解析和一切,但似乎不可能在 Chrome 扩展中使用 Google API。我只是想在单击 chrome 扩展中的按钮时编写一个示例事件,但它一直拒绝加载 Google API,并出现以下错误:
Refused to load the script 'https://apis.google.com/js/platform.js' because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
Run Code Online (Sandbox Code Playgroud)
我的清单.json:
{
"manifest_version": 2,
"name": "DVB2Calender",
"description": "This extension will export the current viewed schedule to your Google Calender.",
"version": "1.0",
"content_security_policy": "script-src 'self' https://apis.google.com/; object-src 'self'",
"browser_action": {
"default_icon": "icon.png", …Run Code Online (Sandbox Code Playgroud) javascript google-calendar-api google-chrome-extension google-api-js-client
我想知道正确的方法是将未知值大小的双倍转换为字符串而不分配太多内存.有没有办法弄清楚双倍的数字?我不想分配太多或太少的内存.