hello there,
I 'm new to this, but I'll appreciate it if someone could help me with my script I'm writing a javascript that add's site to favortites.
It works fine in IE but not in anything else.
This is for a clients site who uses Mac and linux.
I want it to work in all browsers (IE,FireFox,Safari,google Chrome, and Opera).
thanks for your time and please help
and this is the code
<html>
<body>
<script language="JavaScript" type="Text/Javascript">
<!--
var urlAddress = "http://www.maktoob.com";
var pageName = "index.php";
function addToFavorites()
{
if (window.external)
{
window.external.AddFavorite(urlAddress,pageName)
}
else
{
alert("Sorry! Your browser doesn't support this function.");
}
}
// -->
</script>
<script>
/* Modified to support Opera */
function bookmarksite(title,url)
{
if (window.sidebar) // firefox
window.sidebar.addPanel(title, url, "");
else
if(window.opera && window.print)
{ // opera
var elem = document.createElement('a');
elem.setAttribute('href',url);
elem.setAttribute('title',title);
elem.setAttribute('rel','sidebar');
elem.click();
}
else
if(document.all)// ie
window.external.AddFavorite(url, title);
}
// -->
</script>
<a href="javascript:addToFavorites()"><font color="#0000FF"
face="Arial">Bookmark Page !</font></a>
<br/><br/><br/>
<a href="javascript:bookmarksite('minamerica', 'http://www.maktoob.com')">Bookmark this site!</a>
</body>
</html>