I have a Javascript variable fullurl
which is a url of the form http://example.com/page.php?id=123
I'd like to create a mailto link with this URL in the body
html += '<a href="mailto:&subject=Test&body=' + fullurl +'">Click here</a> to email this link';
The result is an email with the body of just http://example.com/page.php
so I imagine it is the? in the URL throwing it off, as it interprets it as the end of the body= part of mailto
You could try to use encodeURIComponent.
fullurl = encodeURIComponent("http://example.com/page.php?id=123")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.