Google Chrome Extension - background script

google-chrome, google-chrome-extension

Solution

The background script should be viewed as "running in the background of the Chrome browser". Your desired effect (running a script for every page) is actually a task for content scripts.

To learn more, read https://developer.chrome.com/extensions/overview.html#arch.

Problem

After messing around with Chrome Extension I noticed that when you are on the `chrome://extensions` page a background script initiated in the manifest file will run where as if you are just browsing the internet or on another other page besides the extension page the background script will not run. Here is what I mean: In my Manifest file: ``` "background": { "scripts": ["jquery-latest.js","background.js"] }, ``` Now in the `background.js` file: ``` $(document).ready(function(){ alert("working"); }); ``` I use a simple alert function to see if this will work and found out that `alert("working");` only gets displayed when I am on the `chrome://extension` directory. If I go to google.com or something of that sort, no cigar. My question lies in, why does this happen? How do I change it so it does alert no matter what.

Original source