I am opening the chrome store in a fullscreen popup.
onclick="window.open('https://chrome.google.com/webstore/detail...', 'targetWindow', 'width=' + window.outerWidth + ',height=window.outerHeight,top=' + window.screenTop + ',left=' + window.screenLeft);
After the user has installed the extension, the focus comes back to the main tab and when my Chrome extension background script run the following code :
chrome.runtime.onInstalled.addListener(function (details) {
if (details.reason == "install") {
thankyou();
}
});
function thankyou(){
chrome.tabs.update({
url: 'https://mythankyoupage.com',
active: true
});
}
The problem is the Thankyou page is loaded in the main tab but NOT in the original popup, which is lost in the background.
How can I make sure the thank you page is loaded in the popup that was used to install from the chrome store ?
I have read https://developer.chrome.com/extensions/tabs but could not understand how to target my popup
Thank you for your guidance
UPDATE 1 :
following good advices from comments, I tried this : (I tried without "windowType":"popup" too)
function thankyou(){
chrome.tabs.query({url: "https://chrome.google.com/webstore/detail/...", "windowType":"popup"}, function(results) {
chrome.tabs.update({
url: 'https://thankyou.com'
})
}
tried this as well :
function(results) { chrome.tabs.update(tabs[0].id, { url: 'thankyou.com', active: true }) }
but all of them resulted in refreshing the main window and not the popup. I do uninstall each time the extension (not just refresh).