I'm developing a chrome extension.
I tried to get the current window then set its width, but it doesn't work ?
Here's the code in background.js:
chrome.windows.getCurrent(
{populate: false},
function(currentWindow) {
currentWindow.width = 500;
}
);
Ans here's the manifest.json:
{
"name" : "windowresizer",
"description" : "resize current window !",
"version" : "1.0",
"manifest_version" : 2,
"background" : {
"scripts" : ["background.js"],
"persistent" : false
},
"permissions" : ["tabs"]
}
Why it doesn't work ?
I'm developing a chrome extension.
I tried to get the current window then set its width, but it doesn't work ?
Here's the code in background.js:
chrome.windows.getCurrent(
{populate: false},
function(currentWindow) {
currentWindow.width = 500;
}
);
Ans here's the manifest.json:
{
"name" : "windowresizer",
"description" : "resize current window !",
"version" : "1.0",
"manifest_version" : 2,
"background" : {
"scripts" : ["background.js"],
"persistent" : false
},
"permissions" : ["tabs"]
}
Why it doesn't work ?
Share Improve this question asked Sep 25, 2013 at 14:24 Ashraf BashirAshraf Bashir 9,80415 gold badges60 silver badges83 bronze badges1 Answer
Reset to default 5You need to use the chrome.windows.update
function:
chrome.windows.getLastFocused(
{populate: false},
function(currentWindow) {
chrome.windows.update(currentWindow.id, { width: 500 });
}
);