mercredi 25 mars 2015

Intercept browser system logs with JavaScript


Vote count:

0




Is it possible to intercept logs in browser which were written not browser engine? For example I need to intercept logs like the followings:



2015-03-25 13:43:31.387 www-embed-player.js:327 Untrusted origin: chrome-extension://boadgeojelhgndaghljhdicfkmllpafd
2015-03-25 13:43:31.397 www-embed-player.js:327 Untrusted origin: chrome-extension://boadgeojelhgndaghljhdicfkmllpafd


I tried to incorporate code like this:



(function(){
var oldLog = console.log;
console.log = function (message) {
// DO MESSAGE HERE.
oldLog.apply(console, arguments);
};
})();


This javascript snippet I put in the head section inside script tag of course. But it seems to be working at all :(


The main goal for me is to intercept error message which says that it's not possible to load page with url "http://example-url.com" into IFRAME because of 'cross-domain-policy'. So I would parse this error message, get this url and open it in new window instead of IFRAME.


I would really appreciate any kind of help!



asked 32 secs ago







Intercept browser system logs with JavaScript

Aucun commentaire:

Enregistrer un commentaire