获取 firefox 插件的唯一客户端 ID

getting a unique client id of a firefox addon

如果有一个唯一的客户端 ID 分配给下载我的插件的人,我该如何获得它?我试过 Client.id,我发现它是实验性的 (https://developer.mozilla.org/en-US/docs/Web/API/Client/id)。 如果没有为下载我的插件的客户分配一个唯一、稳定的客户端 ID,我该如何为他们分配一个?

使用browser.runtime.id:

A string representing the add-on ID. If the extension specified an ID in its applications manifest.json key, runtime.id will contain that value. Otherwise, runtime.id will contain the ID that was generated for the extension.

转到 about:debugging,您将看到所有已安装插件的 ID。