So, I have a chrome extension and for it to work like it should, I need to make some type of if statement asking whether or not the active tab is not loading, please don't be confused with "finished loading".
I've already tried:
chrome.tabs.onUpdated.addListener(function (tabId , info) {
if (info.status === 'complete') {
// code
}
});
but this will only execute the code when the active tab has finished loading.
If you still don't understand what I mean by "finished loading" and "not loading", I basically want it to ask if the tab's title has the loading icon or not.
If you need more information just comment on this question.
My code needed a few minor updates, here's the fixed code:
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if (tab.active && changeInfo.status === 'complete') {
// code to execute when the active tab has finished loading
}
});
Now, this simply confirms that the tab is actually active.
To answer my question, I simply need to create a variable external from the block with a boolean value of false, and then turn it to true after the tab has finished loading. Then, I just check if the variable is true
and if so, it's finished loading and I can do whatever code I want.