KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Can someone can give me how to open an url in background and how can I get data from it. The URL that I want to open is in a page that also I get data from it. I use XPath to get data. This is my code : Popup.js chrome.tabs.query({ active: true, currentWindow: true }, function(tabs){ if(tabs[0].url.indexOf("extranet.louvre-hotels.fr")!=-1) { chrome.tabs.sendRequest(tabs[0].id, { action: "getDOM" }, function(response) { chrome.tabs.getSelected(null, function(tab) { // get response }); }); } }); Manifest.json { "manifest_version": 2, "name": "SymaExtract", "description": "SymaExtract", "version": "1.0", "browser_action": { "default_icon": "icon.png", "default_popup": "popup.html" }, "permissions": [ "webNavigation", "tabs", "background", "http://localhost/extract.php", "http://*/*" ], "background": { "scripts": ["background.js"] }, "content_scripts": [ { "matches": ["http://*/*"], "js": ["dom.js"] } ] } Background.js chrome.tabs.create({url: 'url_that_i_want_to_open'});
Tags (comma-separated)
Save Edits
Cancel