• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Cross browser support for toolbarscripts.js for RH 2017

New Here ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

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

Views

72

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

It Email() works perfectly  in IE

 

Jacob50B9_0-1628529923452.png

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

Jacob50B9_1-1628530119223.png

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

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

Same code, different outputs.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
RoboHelp Documentation
Download Adobe RoboHelp