0
我的擴展應該打開一個彈出窗口(正常的彈出窗口,而不是默認擴展彈出式)具有以下條件:谷歌Chrome擴展:彈出窗口處理
- 只有一個窗口能在瞬間被打開,
- 我想在localStorage中保存窗口大小和位置,並在下次打開時恢復它們。
該怎麼辦?
我想:
chrome.browserAction.onClicked.addListener(function() {
// 1. In this case, variable win is a window object. But it's empty. There
// is no properties/methods to operate with.
var win = window.open('http://example.com','windowname');
chrome.windows.create({
'url': 'http://example.com',
'type': 'popup'
}, function(win) {
// 2. In this case, variable win has some properties, but they are static
// and won't change on window resize/close.
});
});
任何想法?
什麼特別之處打開的窗口?該擴展程序如何知道「窗口」是否已打開?如果它基於URL,[這裏](https://github.com/Rob--W/stackexchange-notifications/blob/4f4aa9ce76bce8f9f8c4180a73c675b5d9651f86/using-websocket.js#L66-L82)就是一個例子。 –