Forum Moderators: open
I had thought that finally (finally!) I would be able to rewrite the javascript links on my site so that it would be possible for readers to bookmark a page which subsequently opens in the Firefox main window.
Yes, of course they can use CTRL+D if they know to do so, but it doesn't hurt to have an on-page option as well.
I am currently using a script which bookmarks pages for both IE and Opera. But, unfortunately, the best it can do for FireFox is to save pages to the bookmarks list... which subsequently open in the side-panel.
This is not what I want, it's not very useful (no URL bar etc.) and its almost certainly not what the novice user expects.
Am I missing something? Is there any way to script a bookmarking function for FF2? Or is this just not going to be possible until FF3 (if ever)?
this will work for IE, Opera and Firefox...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>IE, Opera and Firefox bookmark script</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
li {
margin:5px 0;
}
a {
color:#000;
}
.bm {
color:#900;
}
</style><script type="text/javascript">
window.onload=function() {
links=document.getElementsByTagName('a');
for(c=0;c<links.length;c++) {
if(links[c].className=='bm') { /*this specifies the bookmark links by class*/
links[c].onclick=function() {
bookmarks(this.title,this.href);
}
}
}
}function bookmarks(title,url){
if(window.sidebar) {
window.sidebar.addPanel(title,url,'');
}
else {
if((window.opera)&&(window.print)){
lnk=document.createElement('a');
lnk.setAttribute('href',url);
lnk.setAttribute('title',title);
lnk.setAttribute('rel','sidebar');
lnk.click();
}
else {
window.external.AddFavorite(url,title);
}
}
}</script>
</head>
<body><ul>
<li><a class="bm" title="webmasterworld" href="http://www.webmasterworld.com/">Bookmark webmasterworld.com</a></li>
<li><a href="http://www.w3schools.com/">Do not bookmark w3schools.com</a></li>
<li><a class="bm" title="w3c.org" href="http://www.w3c.org/">Bookmark w3c.org</a></li>
</ul></body>
</html>
birdbrain