Skip to content

Instantly share code, notes, and snippets.

@fearphage
Forked from hallvors/dbg.js
Created December 9, 2013 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fearphage/7875310 to your computer and use it in GitHub Desktop.
Save fearphage/7875310 to your computer and use it in GitHub Desktop.
// post serialized no-script clone back to debugger
if(true){ // this is just to be able to toggle the dumping off easily
(function noscriptDump(){
var clone = document.documentElement.cloneNode(true);
var elms = clone.getElementsByTagName('script')
while(elms.length){
elms[elms.length-1].parentNode.removeChild(elms[elms.length-1]);
}
var html = clone.outerHTML;
var x = new XMLHttpRequest();
x.open('POST', 'http://192.168.1.8:81/SiteCompTest-backend/log.php', true);
x.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
x.onload=function(){ document.title = x.readyState;
if(x.readyState ==4 && /\s*https?:\/\//.test(x.responseText) ){
document.title += x.responseText;
var a = document.body.appendChild(document.createElement('a'));
a.href = a.textContent = x.responseText;
a.style.display="block";
a.style.zIndex = 1000;
}
}
x.send('host='+location.hostname+'&UA='+navigator.userAgent+'&dom='+encodeURIComponent(html));
})();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment