title: Google Chrome Plugin: How to detect URL of selected tab
body: <p>I am trying to attempt my first Google Chrome Extension and have a question.  My end goal is to be able to select a button which will perform the following:</p>
  
  <ol>
  <li><p>Grab the current URL of the selected tab (Ex: www.google.com)</p></li>
  <li><p>Open a new tab using the URL from step 1 and appending a query string to the end (Ex: www.google.com?filter=0)</p></li>
  </ol>
  
  <p>Currently, I was able to figure out how to open a create a new tab which loads a specified URL.  What I am unsure of how to detect the URL from the selected tab and load that value in the new tab.  Suggestions?  Thanks in advance!!  </p>
  
  <p>Code below:</p>
  
  <p>[popup.html]</p>
  
  <pre><code>    &lt;html&gt;
  &lt;head&gt;
  
  &lt;style&gt;
  
  body {
    min-width:175px;
    overflow-x:hidden;
  }
  
  &lt;/style&gt;
  
  
  &lt;script&gt;
  
   function createTab() {
    chrome.tabs.create({'url': 'http://www.google.com'});
   }
  
   function show_alert()
   {
   alert("I am an alert box!");
   }
  
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;input type="button" onclick="createTab()" value="Create New Tab" /&gt;
  &lt;hr/&gt;
  &lt;input type="button" onclick="show_alert()" value="Show alert box" /&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>[manifest.json]</p>
  
  <pre><code>{
    "name": "IGX Plugin",
    "version": "1.0",
    "description": "IGX Plugin",
  
    "browser_action": {
      "default_icon": "favicon.ico",
   "popup": "popup.html"
    },
    "permissions": [
      "tabs"
    ]
  
  
  }
  </code></pre>