Created
December 4, 2013 23:05
-
-
Save hallvors/7797247 to your computer and use it in GitHub Desktop.
Contents of dbg.js is always somewhat random, depends on whatever I needed to inject during the last session - but the noscriptDump() function is always there..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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