I was looking for the javascript to add the link in favorite. I have tried window.external.AddFavorite(location.href, document.title) which is working only in IE. I need to do that for firefox also. After spending few mnutes on google, I found the code working in both.
<script type=”text/javascript“>
function bookmarksite()
{
if (document.all)
{
// For IE
window.external.AddFavorite(location.href, document.title);
}
else if (window.sidebar)
{
// For Firefox
window.sidebar.addPanel(document.title, location.href, “”);
}
}
< /script>< a href=”javascript:bookmarksite();”> Add to favorites< /a>
Happy Programming !!
Hello chiragrdarji
I see you post and make it. But it doesn’t work.
Please correct for me
Thanks guyz! Still looking for safari solution
Good Script! I used it in one of my sites.. it worked like charm!
Hi Chirag,
Here I add new script for bookmark this page/ Add to Favorite and its work in opera too.
function AddToFavorites(obj, title, url)
{
var title = document.title; var url = location.href;
if (window.sidebar) // Firefox
window.sidebar.addPanel(title, url, ”);
else if(window.opera && window.print) // Opera
{
obj.setAttribute(‘href’,url);
obj.setAttribute(‘title’,title);
obj.setAttribute(‘rel’,’sidebar’);
obj.click();
return false;
}
else if(document.all) // IE
window.external.AddFavorite(url, title);
}
Add to favorites
That is all! You have now a full working bookmark us script.
Hey Maulin Pandya – Your code sucks…and so do you! Thanks for wasting my time! Next time check your sh$t before posting!
< a href=”#” onclick="AddToFavorites(this, ‘your title’, ‘your url’);"> Add to favorites< /a>
dont work 😦