gpt4 book ai didi

javascript - 使用弹出栏的 Chrome 扩展

转载 作者:行者123 更新时间:2023-11-28 10:34:34 25 4
gpt4 key购买 nike

我正在尝试制作类似于下图的东西。

http://img696.imageshack.us/img696/8844/testi.jpg

不幸的是,我似乎无法让它在扩展中工作。我收到一条错误消息,指出“加载文档时出错”。上面的屏幕截图是使用本地制作的 html 和 iBox javascript 完成的。是否有任何其他 JavaScript 库允许我像加载栏中的图标一样加载弹出 html?

这是在本地实现代码以打开弹出窗口的方式:

document.addEventListener('keydown', function(e){
if (e.keyCode == 81 && e.altKey && !e.shiftKey && e.ctrlKey) {
iBox.showURL('search.html');
}
}, false);

这是iBox库中的函数:

showURL: function(url, title, params) {
showInit(title, params, function() {
for (var i=0; i<_pub.plugins.list.length; i++) {
var plugin = _pub.plugins.list[i];
if (plugin.match(url)) {
active.plugin = plugin;
plugin.render(url, active.params);
break;
}}});}

这是 xmlhttp 请求:

if (window.XMLHttpRequest) { // Mozilla, Safari,...
http = new XMLHttpRequest();
if (http.overrideMimeType) {
// set type accordingly to anticipated content type
http.overrideMimeType('text/html');
}
}

最佳答案

一种可能是 manifest.json 中的权限设置不正确。如果扩展依赖于制作XMLHttpRequest,则需要查看此doc .

当然,如果iBox“应用程序”的所有依赖文件都位于您的扩展文件夹中,应该没问题。

关于javascript - 使用弹出栏的 Chrome 扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1928784/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com