The script below sends the link of the current page in an e-mail. It works fine when there is a URL with normal characters.
The problem is the page (php) uses ampersands in the URL, and it kills the creation of the link once it hits the first & in the string
(
The script is below. What can I add to get the ampersand problem fixed so the complete URL gets picked up by the script and transfered to the e-mail as intended?
<!– Begin E-Mail-This-Page Script //–>
<form name=”eMailer”>
E-MAIL THIS LINK
<br>
Enter recipient’s e-mail:
<br>
<input type=”text” name=”address” size=”25″>
<br>
<input type=”button” value=”Send this URL” onClick=”mailThisUrl();”>
</form>
var good;
function checkEmailAddress(field) {
// the following expression must be all on one line…
var goodEmail = field.value.match(/b(^(S+@).+((.......
if (goodEmail){
good = true
} else {
alert(‘Please enter a valid e-mail address.’)
field.focus()
field.select()
good = false
}
}
u = window.location;
m = “I thought this might interest you…”;
function mailThisUrl(){
good = false
checkEmailAddress(document.eMailer.address)
if (good){
// the following expression must be all on one line…
window.location = “mailto:”+document.eMailer.address.value+”?subject=”+m+”&body=”+document.title+” “+u;
}
}
</script>
<!– End E-Mail-This-Page Script //–>