Search code examples
javascriptgoogle-chrome-extensionfirefox-addonbrowser-extension

How to wait for browser page load inside extension *popup* script


I'm making a chrome extension where if you click on the icon in the browser bar, then you can press some other buttons in the popup window to interact with the current web page.

But my functionality requires that the web page is loaded. How do I detect in a popup.js file whether or not the browser page that we're currently on has loaded? Since I want to show a loading text instead of showing my regular buttons if the page we're on hasn't fully loaded yet.

Is the only way to use message passing?


Solution

  • Found the solution by using the tabStatus property after querying the active tab when the extension popup icon is clicked. https://developer.chrome.com/extensions/tabs#type-TabStatus