Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-04-2005, 09:20 AM   PM User | #1
volksman
New to the CF scene

 
Join Date: Mar 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
volksman is an unknown quantity at this point
Grabbing page source with Javascript

Ok. I've been looking all night and can't find the answer. This may be impossible but I don't think it is:

I want to use a javascript to pass the page source of an HTML document to a CGI script.

All I need to find out is how do I assign the current page's source to a variable in javascript?

I mean I know I can do something like:

var t = document.title;

And that gets me the title of the page. But how do I just get a dump of the document source?

Is there a way?

Any help would be very much appreciated!
volksman is offline   Reply With Quote
Old 03-04-2005, 09:32 AM   PM User | #2
codegoboom
Regular Coder

 
Join Date: Aug 2004
Location: codegoboom@yahoo.com
Posts: 999
Thanks: 0
Thanked 0 Times in 0 Posts
codegoboom is an unknown quantity at this point
document.documentElement.innerHTML will get you most of it, or IE has a "download behavior" which can get it 'as authored', or there's possibly a way to use a request method of an xml object (not sure...).
__________________
*this message will self destruct in n-seconds*
codegoboom is offline   Reply With Quote
Old 03-06-2005, 08:38 PM   PM User | #3
volksman
New to the CF scene

 
Join Date: Mar 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
volksman is an unknown quantity at this point
Hrm...well I definately need all of the source. This sort of works but doesn't give me complete info....

I would prefer to stay away from anything browser specific as I don't want to have to force the user into a browser....

So what's the scoop with the XML stuff? From what I can find its something like: XMLHTTPRequest but that, from what I can tell, creates another request to the server. Can someone expand a little on this for me? An example script would be perfect as I learn by example...
volksman is offline   Reply With Quote
Old 03-07-2005, 02:12 AM   PM User | #4
codegoboom
Regular Coder

 
Join Date: Aug 2004
Location: codegoboom@yahoo.com
Posts: 999
Thanks: 0
Thanked 0 Times in 0 Posts
codegoboom is an unknown quantity at this point
If you need the current state of the source (if the DOM has been altered), then innerHTML might be the only way--short of inserting diffs into the original.
The request object does its thing in-process, I think; there are several examples of its usage archived in these forums, btw.
__________________
*this message will self destruct in n-seconds*
codegoboom is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:04 AM.


Advertisement
Log in to turn off these ads.