View the Current Page’s Current Source Code
Do you know that when you choose to “View Source” in your browser (Ctrl+U in Firefox). You will see the page source as it is delivered by the server. Any change made by the client-side script will not be seen. So, how do we see the current page CURRENT source code? I have been using Firebug for this, but just now I see somebody post the JavaScript code for this in kaskus (Largest Indonesian Community).
Here is the code he use:
javascript:h=document.getElementsByTagName('html')[0].innerHTML;function%20disp(h){h=h.replace(/</g,'\n<');h=h.replace(/>/g,'>');document.getElementsByTagName('body')[0].innerHTML='<pre><html>'+h.replace(/(\n|\r)+/g,'\n')+'</html></pre>';}void(disp(h));
At a quick glance, this script will replace all “<” with “<” and all “>” with “>” inside the “<html>” tag thus removing all tags and make those tags readable.
Let’s break down the code: Read the rest of this entry »
February 22nd, 2011
JavaScript Tags: current source, javascript script, kaskus, view source
0 Comment
815 views