dcsimg
Email a URL from a button - cool? NOT YET!
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Daniel_Comp
Posted On:   Tuesday, March 4, 2003 09:44 PM

Can anyone tell me why I can get Outlook to open with the 'document.referrer' property but it will not open with either 'window.location' or 'window.location.href' and with 'document.url' it gives me 'undefined' I'm trying to open the default email program from a button with the web page url as the body. The scripts I'm using are below This works fine, but it's not the current URL, it's the referrer: u = document.referrer; function mailThisUrl() { window.location = 'mailto:?subject=Invitation to...&body='+document.title+' '+u; } This loads, but has the URL as 'undefined'    More>>

Can anyone tell me why I can get Outlook to open with the
'document.referrer' property but it will not open with either 'window.location' or 'window.location.href' and with 'document.url' it gives me 'undefined'



I'm trying to open the default email program from a button with the web page url as the body.



The scripts I'm using are below




This works fine, but it's not the current URL, it's the referrer:




u = document.referrer;

function mailThisUrl() {

window.location = 'mailto:?subject=Invitation to...&body='+document.title+'
'+u;


}




This loads, but has the URL as 'undefined'




function mailThisUrl() {

window.location = "mailto:?subject=Invitation to&body="+document.url+" " ;



}




These write the url to the page, but not 'href' into the email body:




r = document.referrer;

t = document.title;

u = location.href;

function mailThisUrl() {

window.location = "mailto:?subject=Invitation to...&body="+r+" "+t+" "+u;

document.write(location.href);

document.write(document.location);




}




In short, the referrer works, but swapping for the url doesn't. WHY?




u = window.location;

function mailThisUrl() {

window.location = "mailto:?subject=Invitation to&body="+document.referrer+"
" ;




}




Any thoughts?




Fixes are better!




Daniel Comp

Daniel@IntelligentNetware.com

   <<Less
About | Sitemap | Contact