开发者

Chrome Extension using popup bar

I'm trying to make something similar to the picture below.

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

Unfortunately, I can't seem to get it to work within the extension. I get an error stating there was "Error loading the document". The screenshot above was done using a locally made html with the iBox javascript. Is there any other javascript library that would permit me to load my popup html the same way it does with an icon in the bar?

This is how the code was implemented locally to open the popup:

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

This is the function in iBox开发者_运维技巧 library:

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;
                }}});}

This is the xmlhttp request:

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


One possibility is that the permissions in manifest.json aren't properly set. If the extension relies on making XMLHttpRequest, you need to look at this doc.

Of course, if all the dependent files for the iBox "application" are all located in your extension folder, it should be OK.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜