PDA

View Full Version : Add to favourites


Ricky55
02-04-2007, 08:50 PM
Hi

I'm using the following code to so the user can add my site to their favourites

javascript:window.external.AddFavorite('http://www.creativeauto.co.uk','Creative Auto Styling for Perfection')

but this only works in ie does anyone have any code that will work in both Firefox and ie?

Thanks

Ricky55

edbr
02-05-2007, 12:14 AM
It cant be done as far as I know but you can trigger an alert

this is what I use
<SCRIPT LANGUAGE="JavaScript">
function addbookmark()
{
bookmarkurl="http://www.your_domain.com"
bookmarktitle="Title - Slogan"
if (navigator.appName == "Microsoft Internet Explorer")
window.external.AddFavorite(bookmarkurl,bookmarkti tle)

else {
alert("Browser does not allow this, Press CTRL-D or CTRL-T (Opera) to bookmark");
}
}
</script>

davidj
02-05-2007, 09:03 AM
why cant you replace the alert() with what ever code is used to set the other browser favorates or bookmarks

Ricky55
02-05-2007, 09:58 AM
Good point!

What is the code to do this in Firefox / Navigator?

I'll give it a try

Ricky55
02-05-2007, 10:00 AM
btw

what code do I enter on my button or link
how do I call the add book mark function via a link?

davidj
02-05-2007, 01:43 PM
<a href="javascript:functionname()"

or


<a href ="#" onclick="functionname()"