0

Hi everyone!
I'm making a chrome extension that displays current page's url once clicked. I've got this so far:

//manifest.json
{
  // Required
  "name": "Marker",
  "version": "1.0.11",
  "manifest_version": 2,

  // Recommended
  "description": "The ultimate bookmarking tool",
  "icons": { "32": "icon.png" },

  // Pick one (or none)
  // Add any of these that you need
  "browser_action": {
    "default_icon": "icon.png",
    "default_popup": "popup.html"
   },
   "permissions": [
      "tabs",
      "http://*/*"],
  "offline_enabled": false
}



<!--popup.html--> <!DOCTYPE html> <html> <head></head> <body> <h1>Shuttlr</h1> <h2>Lol</h2> <script type="text/javascript">
        var pageurl = null;

        chrome.tabs.query({'active': true, 'windowId': chrome.windows.WINDOW_ID_CURRENT},
            function(tabs){
                pageurl = tabs[0].url;
                write_result(pageurl);
            }
        );

        function write_result(needanurl){
            document.write(needanurl);
        }
    </script> </body> </html>

I even made the chrome function fire up another function because the extensions API is asynchronous. I'm still stuck. What do I do?

2
Contributors
2
Replies
19
Views
4 Years
Discussion Span
Last Post by emir_gradacac
0

I'm trying to make a chrome extension that will display the current tab's url when clicked

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.