I just want to send the current tab url to my extension:
Here is my manifest. json
{ "name": "DocUrlExtention", "version": "1.0", "manifest_version": 2, "description": "The first extension that I made.", "browser_action": { "default_icon": "icon.png", "default_popup": "popup.html" }, "content_scripts": [ { "matches": ["http://*/*"], "js": ["contentscript.js"] } ]}
Below is my text contents1.js
chrome.extension.sendRequest({url: window.location.href}, function(response) { console.log(response.farewell); });
Below is my popup.html
<!doctype html> <html> <head> <title>Getting Started Extension Popup</title> <script> chrome.extension.onRequest.addListener( function(request, sender, sendResponse) { console.log(sender.tab ? "from a content script:" + sender.tab.url : "from the extension"); }); </script> </head> <body> <div id="mydiv">Doc Id:</div> </body> </html>
I donβt see anything in the console. I am new to Chrome extensions.
google-chrome google-chrome-extension
Ali May 2, '12 at 15:13 2012-05-02 15:13
source share