In my Google Chrome extension, I have a content_script that I want to communicate with my background_page. Does anyone know how this can be done?
I have found a couple tutorials going over how a background page can communicate with a content_script but, as I have stated, I need the opposite to occur.
I want to run an automated script to clear my cache every 24 hours. I cannot do this from a content_script, I have to do this from the background page. The only way I can get this to work right now is if I tie in a “button” but as I said before, I want it automated to run every 24 hours.
BTW- I am already aware that Content Scripts cannot:
Use chrome.* APIs (except for parts of chrome.extension)
Use variables or functions defined by their extension’s pages
Use variables or functions defined by web pages or by other content scripts
As you can see the first item listed there is: chrome APIs, but I need to use a chrome API in my content_script, so hopefully someone has a work around. Please let me know.
Message Passing Doc from Google
Content script:
Background page:
Also you can open up a Long-lived connection between content scripts and background page:
http://code.google.com/chrome/extensions/messaging.html#connect