Click to See Complete Forum and Search --> : show HTML source-code


lucienne
07-08-2003, 09:29 AM
Is there a way to show the HTML source-code of a page without selecting 'show sourcecode' from the main browser-menu.
What I'm looking for is a button that, when being pressed, displays the HTML source-code, of that particular page, in a new window.
Does anyone have an idea?

Khalid Ali
07-08-2003, 09:41 AM
you can do something like this

var root = document.getELementsByTagName("html")
//now get the html

var rootHTML = root.innerHTML;

//now you can put this code in the a popup window

var pWin = window.open("","pWin","");
pWin.document.open();
pWin.document.write("<html>"+rootHTML+"</html>");
pWin.document.close();

requestcode
07-08-2003, 09:51 AM
I believe this one works:
http://javascriptkit.com/script/cut156.shtml

lucienne
07-09-2003, 01:22 AM
Fantastic!
Thank you!

Brendan Nolan
07-09-2003, 03:05 AM
Originally posted by requestcode
I believe this one works:
http://javascriptkit.com/script/cut156.shtml


That example is not a cross platform/browser solution, however it will work on most versions if IE for the PC.