/    Sign up×
Community /Pin to ProfileBookmark

email url button

I am making a ’email this URL’ button on a fairly simple html site.
Is there a way using html or javascript to have the url automaticaly be filled in in the subject line or content of the email. There are hundres of pages to this site so I dont want to have to type out the url each time. Is there a ‘theURL’ function perhaps.
Thanks!

to post a comment
Full-stack Developer

3 Comments(s)

Copy linkTweet thisAlerts:
@TheBearMayNov 16.2004 — document.location.href will give you the URL.
Copy linkTweet thisAlerts:
@snakedauthorNov 16.2004 — im afraid im an amature, do i use that in a mailto: function?

thanks for your help, i have found very little info in this
Copy linkTweet thisAlerts:
@TheBearMayNov 16.2004 — Something like:
[code=php]
<button onclick="var mailer='mailto:?subject='+document.location.href+'&body=some text here';window.open(mailer);">Mail Location</button>
[/code]


should work
×

Success!

Help @snaked spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...