Forum Moderators: open

Message Too Old, No Replies

Bookmark Webpage - Firefox

         

matthewamzn

1:37 am on Mar 27, 2006 (gmt 0)

10+ Year Member



I'm using this script for bookmark us link. It doesn't work with firefox though. How can I make it compatible?

<a href=\":Bookmark Us\" onDragstart=\"return false\" onClick='window.external.AddFavorite(location.href, document.title);return false'>Bookmark This Website</a>

ecom_guy

11:42 am on Mar 27, 2006 (gmt 0)

10+ Year Member



Hi Matt,

Try this code. Should work properly accross all browsers.

<script language="javascript" type="text/javascript">
<!-- Begin
if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4))
{
var url=document.location.href;
var title=document.title;
document.write('<a class="bkmark" HREF="javascript:window.ext');
document.write('ernal.AddFavorite(url,title);" ');
document.write('onMouseOver=" window.status=');
document.write("'Add our site to your favorites!'; return true ");
document.write('"onMouseOut=" window.status=');
document.write("' '; return true ");
document.write('"><right>Bookmark this page<center/></a>');
}
else
{
var msg = "<span class='bkmark'>Bookmark this Page";
if(navigator.appName == "Netscape") msg += " (CTRL-D)</span>" ;
document.write(msg);
}
// End -->
</script>

All the best
Frank

DrDoc

4:19 pm on Mar 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That won't change what's going on in Firefox, though ... Nor will it show up properly in Mozilla or Opera :)

ecom_guy

5:00 am on Mar 28, 2006 (gmt 0)

10+ Year Member



Hi,

Whats the problem you are having with mozilla and opera?
And the code should work properly in firefox. It should be coming as CTRL+D .
Can you PM me your url?
I can have a look and see whats the problem.

Thanks

DrDoc

4:42 pm on Mar 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The problem is that the OP does not want the user to have to hit Ctrl-D. Instead, the OP wants a JavaScript snippet which adds a bookmark not only in IE, but at least in FF/Moz/NS as well.

Besides ...

if(navigator.appName == "Netscape") msg += " (CTRL-D)</span>" ;

There's no guarantee that Mozilla will keep "Netscape" as their AppName

DrDoc

4:52 pm on Mar 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



function bookmark(url, title) {
if((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
window.external.AddFavorite(url, title);
}
else if(navigator.sidebar) {
window.sidebar.addPanel(title, url, "");
}
}


I don't know when

window.external
became available in IE, but if that is a post version 4 addition, the first check could successfully be changed to
if(window.external)