Sending data from background.html to popup display in Google Chrome Extension

You are trying to send data from your background.html back to your popup display in your google chrome extension. However, all you read was sending using message in google chrome to initial a one way message from your background.html to your content_script.js. But you do not understand why they are using a "tabs" api instead of extensions since you are still talking to your extension instead of the page itself.

Well, you are not wrong here to question the answer given from your result. The reason being is that you do not need to send data from background.html to your popup display. The reason is pretty simple, they are not separated. However, you do not know how to update the popup display when you get the data on your background.html. I believe the issue is similar to the one i previously written. You do not need that additional background.html if you are going to update your popup display and not working with other extension. All you have to do is write all your listener (assuming content_script is firing up to the extension) to your popup display. And you should get all you want in popup display without getting all headache about background.html not working etc. Hence,

  1. Copy all your background.html code into popup display
  2. Remove background.html entirely on manifest.json
  3. Now try to update like a normal page on your popup display
And it should do the trick. Hope it helps 🙂
1&1 Hosting $.99* .COM Domain! Get going with GoDaddy!

2 thoughts on “Sending data from background.html to popup display in Google Chrome Extension

  1. OK! I don't need the background.html. But when i use the chrome.tabs.create() on pupop.html, it can't not excuse the code which after the create function because the new tab is open and the popup id close. how can i solve this issure?

  2. hmmm. i don't quite get your question. as far as i know, when i use chrome.tabs.create on my pop.html, a new tab is open and the pop will remain there until you move to other tab (regardless of which tab). It means you have done with pop.html and want to return back to the browser. If i'm not wrong, your issue is most likely a question on how to permanently hold the pop.html from closing when you navigate through the tabs in chrome?

Comments are closed.