Is there anyway that I can make Chrome Extension's window stick in window even while clicking outside of its resolution?
I'm trying to make it Sticky on the window for one simple google login so that I don't need to go back again to click extension to open it.
By using tabs API you could retrieve
windowId
of the window you want to focus on. You could do it only if needed e.g. by usingquery
method from that API. You could passurl
for example.If you created a window that you want to be still focused then you have its id already in the hand.
After that, you could use window API
update
method in order to draw attention or focus. Take a look atupdateInfo
params -focus
anddrawAttention
.The same could be done by using
tabs
API. You could passtabId
and the URL you want to redirect someone.Now in order to make it work you have a couple of options:
setInterval
which would be used to check if the tabId andwindowId
you want are active and focus the window/tab you want in another case.setInterval
is not recommended you could use alarms. Please take a look atAlarmCreateInfo
,when
param should help you instead of triggering the alarm periodically.windows
andtabs
API to listen on tab / window focus change. Then you will be able block the change (from user perspective) by methods I described before.You should play with all approaches and pick on that suits you, because all of them have some drawback. But don't want to make that comment very long.