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)就是一个例子。 –