Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome Extension Popup Opened Event

I would like to trigger a refresh of the content on my popup when it is opened. According to the chrome.browserAction docs chrome.browserAction.onClicked will not fire if the browser action has a popup.

If I refresh the popup content on document ready, it is only refreshed once when the browser is opened (instead of every time the popup is "shown").

Is there an event fired when the user clicks the browser button/the popup is shown?

I really don't want to have to do a setTimeout(refreshContent(), 1000) on document ready...

like image 572
Greg Avatar asked Jun 05 '13 20:06

Greg


People also ask

How do I stop chrome from popping up extensions?

Open the Chrome browser and click on the three-dot menu icon in the upper right-corner. Click on More tools >Extensions. You'll see a list of all Chrome extensions and a toggle where you can disable every extension.

What is unpacked extension in Chrome?

Chrome extensions can be either packed or unpacked. Packed extensions are a single file with a . crx extension. Unpacked extensions are a directory containing the extension, including a manifest.


1 Answers

Odd.

I have the following manifest:

{
  "name": "A test",
  "version": "1.1",
  "background": { "scripts": ["background.js"] },
  "browser_action": {
      "name": "TEts",
      "default_popup": "popup.html"
  },
  "manifest_version": 2
}

I have the following popup.html

<p>Hello</p>
<script src="popup.js">
</script>

popup.js

window.onload = function() {
  console.log("onload" + Date())
}

And every time that I go into to inspect the logs via Chrome Dev tools I only see one entry and it is the updated "onload" log with the most recent time which suggests that the page is getting reloaded.

like image 179
Kinlan Avatar answered Sep 22 '22 07:09

Kinlan