I want to put something to work but I am totally confused about googles "isolated worlds". I searched a lot but I cannot find the answer to my needs. Workflow: User clicks on extension icon -> a javascript will search on DOM tree for a div "xpto and get its content -> Use this content to do a google search in a new tab.
manifest.json
{
"manifest_version": 2,
"name": "searchongoog",
"description": "test",
"version": "1.0",
"permissions": [ "tabs",
"https://*/*","http://*/*","activeTab"
],
"content_scripts": [
{
"matches": ["https://*/*","http://*/*"],
"js": ["background.js"],
"run_at": "document_end"
}
],
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
}
}
With this I can get the information, but everytime I open a page it automatically gets it done. I dont want that, I want it to do the background.js only when the extension icon is clicked. I tried to invoke the background.js inside popup.html but it doesn't have access to the DOM to extract the information to search.
Any help would be great.
PS: I am a total noob on this, so dont flame me if I am doing totally wrong.
Thanks anyway