Skip to main content
Participating Frequently
Aug 9, 2021 4:33 PM UTC
Question

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();

    This topic is closed to new replies. Start a new post to keep the conversation going.

    5 replies

    Community Expert
    Aug 9, 2021 11:47 PM UTC

    I can see that the bookmark script doesn't support chrome ("//No Chrome support"). And Edge, depending on the version, is also Chrome, so not working in Edge also makes sense.

     

    As Jeff said, I think you'll need to get a web developer to re-write the scripts for modern browsers.

    Translate
    Jeff_Coatsworth
    Community Expert
    Community Expert
    Aug 9, 2021 5:46 PM UTC

    Sorry, not a JS guru - you'll need to find one, I suspect, to add code to handle the mis-behaving browsers.

    Translate
    Jeff_Coatsworth
    Community Expert
    Community Expert
    Aug 9, 2021 5:13 PM UTC

    Is your browser giving any indication of what it's not liking in the scripts?

    Translate
    Jacob50B9Author
    Participating Frequently
    Aug 9, 2021 5:29 PM UTC

    It Email() works perfectly  in IE

     

    Not not in Chrome nor Edge, it jams all the text into the To: field.

    It does not fail but the output is wrong except in IE.

     

    Translate
    Jacob50B9Author
    Participating Frequently
    Aug 9, 2021 5:30 PM UTC

    Same code, different outputs.

    Translate