Cross browser support for toolbarscripts.js for RH 2017
I downloaded this script for Bookmarking and for Emailing a topic. After few browser upgrades both the Bookmark() and Email() are no longer working.
function BookmarkTopic() {//Add bookmark for topic
//Check for local webhelp
var MasterUrl = GetMaster().location.toString();
if(MasterUrl.match(/file:\/\/\//g)) {
alert('Bookmarking does not work on locally installed webhelp.');
return false;
}
var url = GetRelTopicURL();
var title = GetTopicTitle();
if (window.sidebar) // Firefox
window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // Opera
var elem = document.createElement('a');
elem.setAttribute('href',url);
elem.setAttribute('title',title);
elem.setAttribute('rel','sidebar');
elem.click();
}
else if(document.all)// Ie
window.external.AddFavorite(url, title);
else//No Chrome support.
alert('Cannot add the bookmark automatically. Please create a bookmark for the following URL:\n'+url);
}
function Email() {//Create an email with the link to the current topic.
var url = GetRelTopicURL();
var title = GetTopicTitle();
var emailaddress = "";
var message = ""; //Custom message
var mail = "mailto:"+emailaddress+"?subject="+title+"&body="+message+"\n"+title+": "+escape(url);
//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();
