1 <!doctype html> 2 <!-- 3 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this 4 * source code is governed by a BSD-style license that can be found in the 5 * LICENSE file. 6 --> 7 <html> 8 <head> 9 <title>WebNavigation Sample Extension Background Page</title> 10 </head> 11 <body> 12 <script src='./navigation_collector.js'></script> 13 <script> 14 var nav = new NavigationCollector(); 15 16 var eventList = ['onBeforeNavigate', 'onBeforeRetarget', 'onCommitted', 17 'onCompleted', 'onDOMContentLoaded', 'onErrorOccurred']; 18 19 eventList.forEach(function(e) { 20 chrome.experimental.webNavigation[e].addListener(function(data) { 21 if (typeof data) 22 console.log(chrome.i18n.getMessage('inHandler'), e, data); 23 else 24 console.error(chrome.i18n.getMessage('inHandlerError'), e); 25 }); 26 }); 27 </script> 28 </body> 29 </html> 30