I am new to Google Chrome Extensions and I have some basic questions.
I want to make a Chrome extension, and the following diagram:
-a popup containing buttons and result fields (popup.html)
- when I click the button, I want to trigger an event, this event should connect to the web server (I also make a servlet) and collect information from the server. (XMLHttpRequest ())
- after that I want my extension to load the collected information into one of the result fields.
Simple, right? But I have several problems, right at the beginning :( I started developing using reading tutorials, but I have fog on the main structure of the extension. Now I launched the application containing popup.html, manifest.json ... In popup. html theres result field and button
<div id="extension_container"> <div id="header"> <p id="intro">Result here</p> <button type="button" id="button">Click Me!</button> </div> <div id="content"> </div>
When the button is pressed, I fire the event using jquery, here:
<script> $(document).ready(function(){ $("#button").click(function(){ $("#intro").text("Hello, im added"); alert("Clicked"); }); }); </script>
And here is the problem: in popup.html, this does not work, if I load it in Chrome, nothing happens. Otherwise, if I open popup.html in a browser, and not as an extension, everything works fine. So, I think that I have some basic misunderstandings in extension structures, starting from background pages, javascript background, etc. :( Can someone help me?