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 icon smile Sending data from background.html to popup display in Google Chrome Extension
 

Like this post? Share it!

digg 48 Sending data from background.html to popup display in Google Chrome Extension reddit 48 Sending data from background.html to popup display in Google Chrome Extension stumbleupon 48 Sending data from background.html to popup display in Google Chrome Extension delicious 48 Sending data from background.html to popup display in Google Chrome Extension furl 48 Sending data from background.html to popup display in Google Chrome Extension technorati 48 Sending data from background.html to popup display in Google Chrome Extension google 48 Sending data from background.html to popup display in Google Chrome Extension myspace 48 Sending data from background.html to popup display in Google Chrome Extension facebook 48 Sending data from background.html to popup display in Google Chrome Extension twitter 48 Sending data from background.html to popup display in Google Chrome Extension
share save 171 16 Sending data from background.html to popup display in Google Chrome Extension

No related posts.

About Clay

I am Clay who is the main writer for this website. I own a small web hosting company in Malaysia and i'm available to be hired as individual contractor on elance or odesk. You can find me on twitter.
This entry was posted in How-to, Others and tagged . Bookmark the permalink.

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

  1. helloxyz says:

    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. Clay says:

    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?