私の拡張機能は、次の条件でポップアップ ウィンドウ (デフォルトの拡張機能のポップアップではなく、通常のポップアップ ウィンドウ) を開く必要があります。
- その瞬間に開くことができるウィンドウは 1 つだけでした。
- ウィンドウのサイズと位置を 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.
});
});
何か案は?