Ok, here's a strange problem.
I'm trying to use chrome.tabs.executeScript, for the first time
though, and I'm having some trouble.
- I use the extension in an unpacked form.
- My Chrome version is 12.0.725.0 dev on Win7 64bit.
- I have these as permissions: ": [ "tabs", "contextMenus", "http://*/
*" ] }
- The extension used to be an icon on the taskbar, but it failed there
as well. I moved into context menus but it still keeps failing...
In background.html I have this
chrome.contextMenus.create({
title: "Testing",
contexts: ["page"],
onclick: function() { alert('hello'); chrome.tabs.executeScript(null,
{ file : "/bookmarklet.js" }, function() { alert('hello2') } ) }
});
Those alerts are just for some "debugging".
Now... what happens is that on *some* (like 50%) tabs/pages this fails
to execute. There is nothing in the javascript console. Also, when it
fails, the hello2 alert doesn't execute (it executes when this works).
It seems to work here on this page all the time, for example:
http://code.google.com/chrome/extensions/contextMenus.html
... and also all the other pages around there.
Sometimes it works elsewhere too, but it may fail or work on the same
page after browser restart - it varies.
I tried to put a try-catch around executeScript call but it didn't
produce anything.
Not sure how to debug this? Not sure how to proceed. Any ideas?
Thank you,
Ilkka