Skip to main content
Known Participant
September 5, 2014
Question

modifying VanWeelden's email button script to not include topic info?

  • September 5, 2014
  • 1 reply
  • 230 views

I'm using William Van Weelden's JavaScript to put a button on my WebHelp skin that will open the user's email program (Outlook) and populate with our email address.  We do not need anything in the subject line, CC line, BCC line, or in the Body.  We do not need any of the topic information.  When I try to take out just the references to the topic, either the whole script stops working for the other functions I'm using from his script, or RH freezes.  I'm using RH11 with XP Blue skin, and his JavaScript is in the right place in my Baggage files.  What modification(s) do I need to make?  Thanks, and thanks William

Here's the text of his JS:

function Email() {//Create an email with the link to the current topic.

var url = GetRelTopicURL();
var title = GetTopicTitle();

var emailaddress = "test@example.com";
var message = ""; //Custom message
 
var mail = "mailto:"+emailaddress+"&subject="+title+"&body="+message+"\n"+title+": "+escape(url);

var body = document.getElementsByTagName("body")[0];

var a = document.createElement('a');
  a.setAttribute('href', mail);
  a.setAttribute('style', 'display: none');

body.appendChild(a);
a.click();

This topic has been closed for replies.

1 reply

Willam van Weelden
Inspiring
September 8, 2014

If you replace the var mail line with the following, you should be fine:

var mail = "mailto:"+emailaddress;

Kind regards,

Willam