Current location: Hot Scripts Forums » General Web Coding » JavaScript » email a page script, the whole html page!

email a page script, the whole html page!

Reply
  #1 (permalink)  
Old 06-28-06, 03:28 AM
Dactyl Dactyl is offline
New Member
 
Join Date: Feb 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Question email a page script, the whole html page!

Hey everyone

I've been searching for a java script that can email a page by clicking a button on that page, I need the whole html of the page sent by the users default email program, any idea how I can get about doing that?

Thanks allot
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 06-28-06, 12:38 PM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community VIP
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 2,724
Thanks: 0
Thanked 0 Times in 0 Posts
if you could read the file through a javascript:
1. replace all newlines by %0A
2. replace all whitespace by %20

and then just use the mailto function in html:
Code:
<a href="mailto:user@domain.com?body=filedata">mail me</a>
Greetz,
UnrealEd
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

If you want to add me on any IM, pm me first
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 06-28-06, 12:58 PM
TwoD TwoD is offline
Community Liaison
 
Join Date: Sep 2003
Location: 404
Posts: 1,814
Thanks: 0
Thanked 0 Times in 0 Posts
I've never considered this before, since it's usually just form data which gets passed to the email client.
The tricky part would be to get all of the HTML into a form element.
Maybe this could be done by adding an <input type="hidden" id="pageSource" name="pageSource"> field and do somehting like this:
Code:
document.getElementById('pageSource').value="<html>"+document.getElementsByTagName("html")[0].innerHTML+"<\/html>"
Maybe somehting else could be used instead of .innerHTML (I'm thinking nodeValue but doubt it's valid in this case). outerHTML would be great but it isn't supported by many browsers.

I suspect there's a limit to the length of the value of a hidden field, maybe a <textarea> field could be used instead and hidden using styling.

I don't think there's a practical way to actually get the whole page to show up in the client and be sent as a text/html email. As I said, I've never tried this before...

EDIT: Ah, good point UnrealEd.
I wonder if ...body=<html>"+document.getElementsByTagName("htm l")[0].innerHTML+"<\/html>" would work.
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.

Last edited by TwoD; 06-28-06 at 01:04 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 profitable script sites for sale cms-master.com General Advertisements 3 07-03-07 10:17 AM
Script for Downloads Page tech.dude0314 Script Requests 1 05-30-06 03:32 PM
Email Forwarding Script Makaveli19 Script Requests 2 03-06-06 08:46 AM
accessing existing ISP email with a PHP webmail script. nlancaster PHP 1 01-07-04 03:28 AM


All times are GMT -5. The time now is 09:12 PM.
vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.