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', 'window.location.href', or 'document.url'
I'm trying to open the default email program with the web page url as the body from a button, but all 2 of the methods above give me errors and the last is just an 'undefined' URL
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?
Better yet, a fix?
Daniel Comp
<!-- e --><a href="mailto[email protected]">[email protected]</a><!-- e -->
'document.referrer' property but it will not open with either
'window.location', 'window.location.href', or 'document.url'
I'm trying to open the default email program with the web page url as the body from a button, but all 2 of the methods above give me errors and the last is just an 'undefined' URL
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?
Better yet, a fix?
Daniel Comp
<!-- e --><a href="mailto[email protected]">[email protected]</a><!-- e -->