Skip to main content
Participating Frequently
August 9, 2021
Question

Cross browser support for toolbarscripts.js for RH 2017

  • August 9, 2021
  • 3 replies
  • 166 views

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 has been closed for replies.

    3 replies

    Community Expert
    August 9, 2021

    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.

    Jeff_Coatsworth
    Community Expert
    Community Expert
    August 9, 2021

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

    Jeff_Coatsworth
    Community Expert
    Community Expert
    August 9, 2021

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

    Jacob50B9Author
    Participating Frequently
    August 9, 2021

    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.

     

    Jacob50B9Author
    Participating Frequently
    August 9, 2021

    Same code, different outputs.