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();
Copy link to clipboard
Copied
Is your browser giving any indication of what it's not liking in the scripts?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Same code, different outputs.
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.
Copy link to clipboard
Copied
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.