javascript for bookmarking a site/page

User Help for Mozilla Firefox
Post Reply
MarkHawaii
Guest

javascript for bookmarking a site/page

Post by MarkHawaii »

I used this script:

function addBookmark(url, title)
{
if (!url) url = location.href;
if (!title) title = document.title;

if (window.external)
window.external.AddFavorite(url, title)
if (window.sidebar)
window.sidebar.addPanel(title, url, "");
//Opera7+
else if (window.opera && document.createElement)
{
var a = document.createElement('A');
if (!a) return false; //IF Opera 6
a.setAttribute('rel','sidebar');
a.setAttribute('href',url);
a.setAttribute('title',title);
a.click();
}
else
{
return false;
}
}

Worked perfectly in IE6, Opera8,9, FF1.5 and etc. Now I am not sure when, but FF ceased to work, I have 2.0.0.1 installed and I am not sure if it is branch 2 that doesnt work or it stopped working prior to releaseing FF2. This snippet is for FF
if (window.sidebar)
window.sidebar.addPanel(title, url, "");

And it worked.

Do you know how to fix this and have it working for FF as well?
And this is the link I use:
<a href="javascript:void(addBookmark())">Bookmark</a>

Thanks
Guest
Guest

Post by Guest »

It's impossible to add bookmark via JavaScript in Firefox.
Guest
Guest

Post by Guest »

Anonymous wrote:It's impossible to add bookmark via JavaScript in Firefox.


Since when??

Is this documented????

Thanks
Guest
Guest

Post by Guest »

It has never been possible. It's a security measure. And good one. I'll create my bookmarks myself, thank you.
Post Reply