Can someone please give me how to open the url in the background and how can I get the data from it. The URL I want to open is on the page where I also receive the data. 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) {
});
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'});
source share