I tried some "add to favorties" JavaScript scripts.. With IE8, I get an "access denied" (is that even possible to add a bookmark via JS with IE8?) and it just doesn't work with IE6... Anybody has a good script that works on most browsers?
Thanks!
I tried some "add to favorties" JavaScript scripts.. With IE8, I get an "access denied" (is that even possible to add a bookmark via JS with IE8?) and it just doesn't work with IE6... Anybody has a good script that works on most browsers?
Thanks!
Hi,
Both IE6 and IE8 will need the users to press CTRL+D to add the website to the favourites.
Edit: Sorry, I run into a brain malfunction and mixed some words out.
Actually, IE8 allows javascript to manage the favourites.
To be more precise, and if you use jquery on your website, here's an example :
$("a.bookmark").click(function(e) {
if ($.browser.opera == false) {
e.preventDefault();
var url = this.href;
var title = this.title;
if ($.browser.mozilla == true) {
window.sidebar.addPanel(title, url, '');
return false;
} else if($.browser.msie == true) {
window.external.AddFavorite( url, title);
return false;
} else {
alert('Please use CTRL + D to bookmark this website.');
}
}
});
Note: the "a.bookmark" is required to work with opera, since it recognizes .bookmark class in anchor tags and executes the bookmark funcion on click.
It supports IE7 & 8, Firefox 2 & 3, and Opera 9 (at least) .. Safari isn't supported, and IE6 I couldn't test it here, sorry.
This solution looks solid. But I'd recommend that you test it across whatever browsers you plan to support.
I have a client who wants this. So far as tested this is a totally 100% cross platform solution. Not only does it give the standard bookmarking functionality, but it educates your user at the same time :) :) :)
I've tested it as working on Chrome, Firefox and IE.
Code is below:
<a class="button" onClick="alert('Hold down Ctrl and D at the same time to add this to your favourites')">Bookmark</a>
.. now the real question is whether to use confirm or alert. Confirm may give the users a reassuring but false sense of control about whether they added the bookmark or not?