Google chrome extension 更改安装后出现的弹出窗口中的默认文本

Google chrome extension 更改安装后出现的弹出窗口中的默认文本,google-chrome-extension,Google Chrome Extension,安装完成后,会打开一个弹出窗口,其中默认文本为扩展名已添加到Chrome中。单击此图标使用此扩展… 我可以将此文本更改为我自己的文本吗?您可以在此处使用chrome.runtime.onInstall和OnInstalledReason设置安装后的默认行为。您可以在欢迎信息或说明中设置新的自定义页面以使用扩展名 chrome.runtime.onInstalled.addListener(function (object) { if (chrome.runtime.OnInstalle

安装完成后,会打开一个弹出窗口,其中默认文本为
扩展名已添加到Chrome中。单击此图标使用此扩展…


我可以将此文本更改为我自己的文本吗?

您可以在此处使用
chrome.runtime.onInstall
OnInstalledReason
设置安装后的默认行为。您可以在欢迎信息或说明中设置新的自定义页面以使用扩展名

chrome.runtime.onInstalled.addListener(function (object) {
    if (chrome.runtime.OnInstalledReason.INSTALL === object.reason) {
        chrome.tabs.create({url:chrome.extension.getURL("welcome.html")}, function (tab) {
            console.log("New tab launched with instructions to use the extension");
        });
    }
});

这在
background.js
上,安装时会触发。使用这种方式,您甚至可以设置更新事件,以便通知用户扩展上的新更改。

是否应将
welcome.html
添加到
manifest.json
?它是否是
默认弹出窗口
?是的,应该添加到
web\u accessible\u resources
下的清单中,如下所述:我在
chrome.tabs.create(url:chrome.extension.getURL(“welcome.html”)}行的参数列表
后得到一个错误
未捕获的语法错误(缺失){/code>请在“url:…”之前添加{
chrome.runtime.onInstalled.addListener(function (object) {
    if (chrome.runtime.OnInstalledReason.INSTALL === object.reason) {
        chrome.tabs.create({url:chrome.extension.getURL("welcome.html")}, function (tab) {
            console.log("New tab launched with instructions to use the extension");
        });
    }
});