Welcome to WebmasterWorld Guest from 50.17.114.227

Forum Moderators: open

Message Too Old, No Replies

Revealing html from javascript?

How to see the source?

     
11:05 pm on Jun 2, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:June 13, 2004
posts:650
votes: 0


Besides DOM Inspector, what would be other ways to get source code of embedded html documents in javascript?
2:02 am on June 3, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Apr 14, 2003
posts:438
votes: 0


With the Web Developer extension for Firefox you can view generated source
8:08 am on June 3, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:June 13, 2004
posts:650
votes: 0


Thanks Outrun.
Actually, in Firefox I can view it by simply selecting anything on the page (or Ctrl-A) and using "View Selection Source".

Is there any way, in any language, to get the code automatically and save the file?

11:49 am on June 3, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:June 13, 2004
posts:650
votes: 0


If I wasn't entirely clear, maybe this post was more outlined: [webmasterworld.com...]
1:55 pm on June 5, 2006 (gmt 0)

Junior Member

5+ Year Member

joined:May 24, 2006
posts:93
votes: 0


You could probably do it with a javascript bookmarklet. search out the script tags, and document.write their .data properties into a new window.

Edit:
Oops, sorry. After a re-read of the original post, I realise you are after the complete oposite of what I'm suggesting. (you want to capture the HTML content, generated by javascript). Please disregard this post.

2:11 pm on June 5, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:June 13, 2004
posts:650
votes: 0


No problem, everything is welcome.
6:44 pm on June 5, 2006 (gmt 0)

Full Member

10+ Year Member

joined:Aug 21, 2003
posts:203
votes: 4


javascript:'<code><ol><li>'+(document.documentElement¦¦document.body).outerHTML.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/ /g,"&nbsp;").replace(/\n/g,"<li>")+'<\/ol><\/code>';

Saved as a bookmarklet will render not just the html but the JS within the HTML that makes more JS etc etc etc. I have some others too that some people may prefer but they are at work and I aint :)