views:

374

answers:

1

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');
   }
  }
A: 

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.

jldupont
Yes it is. I'm also loading it at start in the manifest.json with "js": [ "contentScript.js", "ibox.js" ]
Guibone
What do you mean? is the `permissions` list set accordingly? please clarify.
jldupont
Sorry about that. What I meant is that the "content_scripts" had the above line. The permissions simply has the "tabs" and "bookmarks" for the extensions functionally
Guibone
check with the "developer tools" if iBox makes XMLHttpRequests to an external origin.
jldupont
I think you we're right. I'll take a look at the doc you suggested. I put the code of what I found in my question
Guibone
Is my answer/help satisfactory then?
jldupont