gpt4 book ai didi

javascript - 我想在 Chrome 中创建新选项卡时重定向到自定义 html 页面

转载 作者:行者123 更新时间:2023-12-02 22:35:26 25 4
gpt4 key购买 nike

我正在开发一个 Chrome 扩展。我想在创建新选项卡时重定向到自定义 html 页面。

这是 process.js 文件。

    chrome.tabs.onCreated.addListener(function() {
alert("hello");
window.open('https://ucsc.cmb.ac.lk/', '_self', false);
});

这是manifest.json 文件。

    {
"manifest_version": 2,
"name": "xxx",
"version": "1.0",
"description": "xxx",
"icons": {
"128": "icon128.png",
"48": "icon48.png",
"16": "icon16.png"
},
"browser_action": {
"default_icon": "icon16.png",
"default_popup": "popup.html"
},



"background": {
"scripts": ["process.js"],
"presistent": true

},

"permissions": [
"storage",
"notifications",
"contextMenus",
"tabs",
"activeTab",
"http://*/",
"https://*/"
]
}

警报正在运行。但它没有加载页面。

最佳答案

您可能正在寻找Override Pages .

将此代码添加到您的 list 文件中:

"chrome_url_overrides" : {
"pageToOverride": "myPage.html"
},

关于javascript - 我想在 Chrome 中创建新选项卡时重定向到自定义 html 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58761676/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com