購買預設在擴充功能圖示下方開啟的彈出窗口,我們可以透過建立新視窗來變更位置
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中文網其他相關文章!