Click to See Complete Forum and Search --> : Email URL from button - cool? NOT YET!


Daniel Comp
03-04-2003, 11:32 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', '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
Daniel@IntelligentNetware.com
:confused:

gil davis
03-05-2003, 06:11 AM
This works:<form action="mailto:whoever@nowhere.com">
<input type="hidden" name="body">
<input type="button" onclick="this.form.body.value=window.location.href" value=" Test "><br>
<input type="submit" value=" Mail Me! ">
</form>

Daniel Comp
03-05-2003, 09:19 AM
This code uses a two step (2 button) process and brings up a fat alert box that will alarm the senior citizens using the page.

Thanks, but I'll have to see if I can find something else.

Appreciate your response.

Daniel

gil davis
03-05-2003, 09:37 AM
This also works:<script>
function mailThisUrl() {
r = document.referrer;
t = document.title;
u = window.location;
window.location = "mailto:?subject=Invitation to...&body="+r+" "+t+" "+u;
}
</script>
<a href="#" onclick="mailThisUrl();return false">mail it</a>Maybe I don't understand your problem.

Daniel Comp
03-05-2003, 02:48 PM
It turns out that the scripts work fine. The error I'm getting is from Outlook trying to add the URL address into the email when the address includes the " mark - as in www.blah.page.rs_Action=find("ID", 5)

When I change the "ID" to 'ID' it all works fine.

Now the problem is how to get Vbscript in the referring calendar page to not interpret the 'id' as a comment, but keep the ' marks in.

Any thoughts on this one??

.Write "<a href='events.asp?rsEvent_Action=Find( 'ID'," & objRSTemp("id") & ")#'>"

Thanks in advance.