开发者

Safari Extension - images in dynamic extension menu

开发者 https://www.devze.com 2023-03-26 23:59 出处:网络
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.

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';
0

精彩评论

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