按照网络教程建立 CortanaUseGoogle 文件夹和两个子文件 CortanaUseGoogle.js 以及 manifest.json。
代码如下:
1.CortanaUseGoogle.js:
chrome.webRequest.onBeforeRequest.addListener(
function(details) {
return { redirectUrl: “ https://www.google.com/search?q=” + details.url.split(/=|&/)[1].replace(“%20 ″, “+”)};
},
{urls: [“ https://cn.bing.com/search*”]},
[“ blocking ”]
);
2.manifest.json
{
“ name ”: “ Cortana use Google ”,
“ version ”: “ 1.0 ”,
“ manifest_version ”: 2,
“ description ”: “ Just a extension ”,
“ background ”: {
“ scripts ”: [ “ CortanaUseGoogle.js ” ]
},
“ permissions ”: [
“ webRequest ”,
“ webRequestBlocking ”,
“ https://cn.bing.com/”
]
}
为什么会无法成功?
chrome 扩展程序说:Manifest is not valid JSON. Line: 3, column: 2, Dictionary keys must be quoted.
问题出在哪里?
是不能创建成功方法不对还是说代码错误,、?
不是很懂计算机编程,
代码如下:
1.CortanaUseGoogle.js:
chrome.webRequest.onBeforeRequest.addListener(
function(details) {
return { redirectUrl: “ https://www.google.com/search?q=” + details.url.split(/=|&/)[1].replace(“%20 ″, “+”)};
},
{urls: [“ https://cn.bing.com/search*”]},
[“ blocking ”]
);
2.manifest.json
{
“ name ”: “ Cortana use Google ”,
“ version ”: “ 1.0 ”,
“ manifest_version ”: 2,
“ description ”: “ Just a extension ”,
“ background ”: {
“ scripts ”: [ “ CortanaUseGoogle.js ” ]
},
“ permissions ”: [
“ webRequest ”,
“ webRequestBlocking ”,
“ https://cn.bing.com/”
]
}
为什么会无法成功?
chrome 扩展程序说:Manifest is not valid JSON. Line: 3, column: 2, Dictionary keys must be quoted.
问题出在哪里?
是不能创建成功方法不对还是说代码错误,、?
不是很懂计算机编程,
