购买默认在扩展程序图标下方打开的弹出窗口,我们可以通过创建新窗口来更改位置
chrome.action.onClicked.addListener(async (tab) => { openPopup(tab) }); const openPopup = async (tab) => { const currentWindow = await chrome.windows.getCurrent(); let window = await chrome.windows.create({ url: './popup.html', type: 'popup', width: 320, height: 578, left: currentWindow.left + currentWindow.width - 320, top: 100 }); chrome.windows.update(window.id, { focused: true }); }
以上是Chrome扩展开发:如何打开页面右侧和顶部的popup.html的详细内容。更多信息请关注PHP中文网其他相关文章!