1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Let the background page know this content script executed.
6 var inject = 'chrome.runtime.sendMessage({greeting: "hello"});';
7 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
8 chrome.tabs.executeScript(tabId, {code:inject});
11 chrome.runtime.onMessage.addListener(
12 function(request, sender, sendResponse) {
13 // Let the extension know where the script ran.
14 var url = sender.tab ? sender.tab.url : 'about:blank';
15 chrome.test.sendMessage('execute: ' + url);