0

I am new to stackoverflow and generally new at chrome extensions and Javascript, so bear with me! I am creating an extension that consists of a popup window that displays a form where notes can be taken concerning a specific set of web pages. When the form submits (or maybe on load), I would like my extension to extract the URL from the active tab and send it along with all other form data as a reference in the database. Is this possible? I was hoping that the web URL would automatically populate a specific non-editable text box upon launching the popup. Just not sure where to start...Ideas?

I have a popup.html which contains the form and it already submits correctly to a MySQL database. I also use the popup.js file in the extension.

From what I have read, I need to include a "chrome.tabs.query()" function into my code, but I am unsure of how to write the function in javascript and how to interface the variable with the form.

Thanks in advance!

Randy
  • 3
  • 2
  • http://stackoverflow.com/questions/1979583/how-can-i-get-the-url-for-a-google-chrome-tab – Vlad Nov 07 '14 at 22:23
  • Yes, I have poured over this discussion.. I am still not putting it together in my head. I guess any further help would be appreciated. – Randy Nov 07 '14 at 22:31
  • Specifically, even after the function is written, how would it interact with the form? – Randy Nov 07 '14 at 22:37
  • You can run that function from javascript code associated with your form. To interact with your form, you need to write code in the getSelected callback method, since the communication with the tab is Asynchronous. – Vlad Nov 11 '14 at 20:15
  • check out this sample page on google. They have example extensions that you can try out. https://developer.chrome.com/extensions/samples – Vlad Nov 11 '14 at 21:03

0 Answers0