Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to view the current html of a web page? 1

Status
Not open for further replies.

jsteph

Technical User
Oct 24, 2002
2,562
US
(I'm not sure if this is the correct forum for this question--please direct me to the right one if this is not)

When I left-click an html page and do 'View Source', I see the html behind the scenes of that page. Yet if that page has code that, say, adds rows to an html table or something like that--these new rows don't show up as 'source', which I suppose is understandable because they aren't the 'original' source.

But is there a way can I view the actual, real-time html behind what is actually displayed on my screen? Thanks,
--Jim
 
Dan,
I'm talking about a page that is not my own. I'm guessing this would have to look in ie's memory space to get this info. Is there a 'real-time' view-source utility somewhere?
--Jim
 
Use the above typed into the URL bar, prefixed with "javascript". So, on any page, type this into the URL bar:

Code:
javascript:alert(document.getElementsByTagName('body')[0].innerHTML);

P.S. This should really be taken to the JS forum if further discussion is required.

Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thanks! That's exactly what I needed,
--Jim
 
Note that you can actually store the javascript: "url" in a bookmark and activate it that way. That is what is known as a "bookmarklet". If you google that word you'll find a bunch of sites that have some really useful bookmarklets.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Chris, Tracy,
Thanks, although I don't use Firefox (yet), that sounds like a good tool...maybe IE7 will have that. The bookmarlets are really interesting little tidbits, they cold be useful.
--Jim
 
jsteph, adam already wrote up a bookmarklet to do exactly what you're saying, it's in the javascript faq section. Here's a direct link: faq216-4345

You'll want the one at the very bottom "show derived code", however you might wanna check out the rest, some are pretty helpful.

-kaht

Looking for a puppy?

silky-icon-left.gif
[small]Silky Terriers are small, relatively odorless dogs that shed no fur and make great indoor pets.[/small]
silky-icon-right.gif
 
kaht,
I checked out those bookmarklet's on Adam's Faq, and when I try to run them, I get "Permission Denied". I think it's not so much the actual bookmarklet, but the adding of a Favorite that's causing the error.

In IE6, how do I allow this? I can't see any setting in Security that seems obvious, plus, that section is divided into Zones--but if I'm just pasting the 'add favorite' code, that's not technically *any* zone (that I can see).
Thanks for any help,
--Jim
 
Hmm..... I never had any problems before when I added them (about 2ish years ago). However, this sounds like something from the advent of SP2 - IE really tried to tighten down the security settings with that patch.

I looked around a bit on google and didn't see what security setting you have to flip to get it to work, so it might just not be possible to use window.external.addFavorite anymore. Nevertheless, you can just copy the code that is in each of his bookmarklets and make your own bookmarks with them manually:

1) add any page to your "favorites"
2) from the favorites pulldown menu right-click the newly added link
3) in the url field paste the javascript from the bookmarklet

-kaht

Looking for a puppy?

silky-icon-left.gif
[small]Silky Terriers are small, relatively odorless dogs that shed no fur and make great indoor pets.[/small]
silky-icon-right.gif
 
kaht,
That's what I ended up doing...had to remove a few escape slashes since one level of nesting was gone, but it works now. Thanks,
--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top