Reputation: 1249
I've developed a little chrome extension for personal needs. But there's something in the user experience I don't like, the pop-up containing the application automatically closes when it loses the focus.
I would like to control the closing behaviour and/or create an always on top popup, I've tried to find my way on Google, Chrome dev forums and API ref but can't find a way to accomplish that.
Upvotes: 4
Views: 10414
Reputation: 20478
Look at this article: http://www.chromium.org/developers/design-documents/extensions/proposed-changes/apis-under-development/panels
Enable using panels here: chrome://flags/#enable-panels
Here is the code I use to create a panel:
let window_id;
chrome.browserAction.onClicked.addListener(()=>{
if(window_id === undefined){
chrome.windows.create(
{url:'panel.html', type:'panel', focused:true, width:150, height:162}
,_=>window_id = _.id
);
}else{
chrome.windows.update(window_id, {focused:true});
}
chrome.windows.onRemoved.addListener(_=>_ === window_id? window_id = undefined:3);
});
Upvotes: 5
Reputation: 572
Apparently you need to set the type to 'panel', and I can't tell whether this is possible or not at the moment. From what I gather, you can set type to panel, but you'll need to set the key-value pair in the manifest.json to the one used by GTalk(Hangouts) which will stop you being able to use the GTalk/Hangouts panel.
There's a bit more of an explanation here: Having panel behavior in chrome extension
Upvotes: 1