Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Full link to a file

I'm trying to implement a "email this page to a friend" thing on my site and seem to have hit a problem.  I put the following code in:

<A href="mailto:?subject=Interesting news story...&body=Check it out:%0d%0d{$.link$}">Email it to a Friend</A>

This just gives me the file name (e.g. fog0000000039.html) rather than the full file name (including folders, etc) that I need. (eg:  www.mysite.com/fldr/fog00039.html )

Any suggesstions?

Thanks,
Ben

Ben Riga
Wednesday, February 13, 2002

Unfortunately, that seems to be the way CityDesk handles {$.link$}. Since a file will always be in the same folder as itself, the link to itself will only be the filename.

CityDesk has no way of knowing what the root of the site is, so it can't ever code "hard links."

Mark W
Wednesday, February 13, 2002

bummer.  Do you know if there is anyway to get this using straight HTML or JavaScript?

Ben

Ben Riga
Thursday, February 14, 2002

This came up recently... To get a referrer it's document.referrer in JavaScript.

Mark W
Thursday, February 14, 2002

Sorry, I should be more explicit. If you create a "contact us" page the way to get the place they came from is document.referrer. I believe your current URL is document.location, but I should probably be keeping my mouth shut about matters JavaScript.

Mark W
Thursday, February 14, 2002

Wouldn't it be possible to construct the "full path" by providing it in the Locations? You already provide a subdirectory, adding a "root path" for the http server would provide everything needed, no?

Maury Markowitz
Friday, February 15, 2002

Finally figured it out, you have to wrap the whole Href with a script:

<script> document.write("<A href=\"mailto:?subject=Interesting news story...&body=Check it out:"+document.location+"\">Email it to a Friend</A>");
</script>

Not sure if you'll want to replace the spaces with %20 in the URL.

Mark W
Saturday, February 16, 2002

That's fantastic.  Thanks!  It's exactly what I needed.

Ben

Ben Riga
Saturday, February 16, 2002

Glad I could be of help. =)

Mark W
Tuesday, February 19, 2002

*  Recent Topics

*  Fog Creek Home