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