Do you want to buy me a beer or coffee?

Thursday, March 5, 2009

javascript 4 add to favorite Or bookmark

<script language="JavaScript1.2" type="text/javascript">
function CreateBookmarkLink() {
title = "ttNotes - Hot Spot";
url = "Http://ttNotes.blogspot.com/";

if (window.sidebar) { // Mozilla Firefox Bookmark
window.sidebar.addPanel(title, url,"");
} else if( window.external ) { // IE Favorite
window.external.AddFavorite( url, title);
} else if(window.opera && window.print) { // Opera Hotlist
alert("Please Click [Ctrl + T] or [apple + T]");
} else { // Opera Hotlist
alert("Please Click [Ctrl + D] or [apple + D]");
}
}

if (window.external) {
document.write('<a href = "javascript:CreateBookmarkLink();">Add to Favorites</a>');
} else if (window.sidebar) {
document.write('<a href = "javascript:CreateBookmarkLink();">Bookmark Page</a>');
} else if (window.opera && window.print) {
document.write('<a href = "javascript:CreateBookmarkLink();">Add Bookmark</a>');
}
</script>

unfortunately, as far as we all know, the Bookmark functionality in FF can only be accessed through the window.sidebar element - i.e. we actually have to add the bookmark to FF’s sidebar…making it a pseudo bookmark really. I’ve looked around quite a bit on the subject and cannot find any documentation saying otherwise, so if you find something to the contrary I’d love to know about it.

But you can manually fix it. Right click on the bookmark and select “properties.” There’s an option for “Load this bookmark in the sidebar.” If you check that button, every time you click on that bookmark, it will open up in your sidebar.

if you uncheck the option, it will open the page in firefox main frame.


0 comments:

Post a Comment

<--nothing-->