I'm working on a Safari Extension with a dynamic Extension Menu.
I am trying to place an icon by each dynamic entry in the menu.
When I reference an image on a server:
var menuItem = event.target.appendMenuItem("bb"+i, i开发者_Go百科+" - "+itemTitle);
menuItem.image = 'http://www.google.com/favicon.ico';
the image appears by each menu item, however, when I try to use an image in my extension:
var menuItem = event.target.appendMenuItem("bb"+i, i+" - "+itemTitle);
menuItem.image = 'menu.png';
the image won't show.
What's going wrong here - the code is in mu global.html file, and the image is in the same location as the global.html file?
Well, I found the answer so here it is for anyone else with the wanting to know:
var menuItem = event.target.appendMenuItem("bb"+i, i+" - "+itemTitle);
menuItem.image = safari.extension.baseURI+'menu.png';
精彩评论