Friday, December 18, 2009

Add To Bookmark Or Favorites in IE7 and IE8

It seems nothing work in IE 8 (Perhaps in Ie7 Too) for Add To Bookmark Or Favorites.
The problem is window.external.AddFavorite object which does not work in IE until you do a registry change.If you a developer and building a website its not defiantly a option.So I have modified the Code to allow for IE users


<script type="text/javascript">
function bookmarkme(title,url){
if (window.sidebar) // Firefox 2 and Higher
window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera ,who cares for Chrome yet
var elem = document.createElement('a');
elem.setAttribute('href',url);
elem.setAttribute('title',title);
elem.setAttribute('rel','sidebar');
elem.click();
}
else if(document.all)// IE 7 and Internet explorer 8
alert("Internet Explorer Users Please click CTRL+D to Bookmark this page");
}
</script>

<a href="javascript:bookmarkme('I Love Google', 'http://www.google.com')">I Love Google!</a>

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home