How to load icon to reader iframe?

66 views
Skip to first unread message

volatile static

unread,
Aug 16, 2023, 8:25:45 PM8/16/23
to zotero-dev
Hi, developers.
As far as I know, the assets of reader were located at `resource://zotero/reader` and elements in that iframe could use relative path. How to add my icon to `resource://zotero` then?
When I tried to add a `link` element with href `file:///`(root URI) or `chrome://addon`, they didn't take effects. However, a `chrome://addon/ico.png` path won't be loaded to neither `img.src` nor `background-image` unless it had been loaded to main window before.
Need your help, thanks!
regards,
v_s

iseexuhs

unread,
Aug 18, 2023, 12:07:03 AM8/18/23
to zotero-dev
Here, I suggest two solutions (the first is better):

1. add this following codes in bootstrap --> startup

    if (Zotero.platformMajorVersion >= 102) {
      var aomStartup = Components.classes[
        "@mozilla.org/addons/addon-manager-startup;1"
      ].getService(Components.interfaces.amIAddonManagerStartup);
      var manifestURI = Services.io.newURI(rootURI + "manifest.json");
      chromeHandle = aomStartup.registerChrome(manifestURI, [
        ["content", "yourPluginName", rootURI + "chrome/content/"],
      ]);
    }

2. add rootURI to Zotero Object.

volatile static

unread,
Aug 20, 2023, 8:14:02 PM8/20/23
to zotero-dev
Thanks, but I have done them already.
Reply all
Reply to author
Forward
0 new messages