OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 chrome.extension.onRequest.addListener( |
| 6 function(url, sender, sendResponse) { |
| 7 var req = new XMLHttpRequest(); |
| 8 console.log('Requesting url: ' + url); |
| 9 req.open('GET', url, true); |
| 10 |
| 11 req.onload = function() { |
| 12 sendResponse({ |
| 13 'event': 'load', |
| 14 'status': req.status, |
| 15 'text': req.responseText |
| 16 }); |
| 17 }; |
| 18 req.onerror = function() { |
| 19 sendResponse({ |
| 20 'event': 'error', |
| 21 'status': req.status, |
| 22 'text': req.responseText |
| 23 }); |
| 24 }; |
| 25 |
| 26 req.send(null); |
| 27 }); |
| 28 |
| 29 chrome.extension.sendRequest('injected'); |
OLD | NEW |