0

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>
3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by irammunir82
0
<FORM>
<INPUT TYPE="button" VALUE="Add to Favorites" onClick='window.external.AddFavorite(location.href, document.title);'>
</FORM>
0
<html>
<head runat ="server" >
<title ></title>
</head>

<script type="text/javascript">
        function Add_Bookmark_Favorite(url,title) 
        {
         if (window.sidebar) 
         { // Mozilla Firefox Bookmark
             //Make sure "Load this bookmark in the sidebar is deselected
          window.sidebar.addPanel(title, url,"");
          return false;
         } 
         else if( window.external ) 
         { // IE Favorites
          window.external.AddFavorite( url, title); 
          return false;
         }
         else if(window.opera && window.print) 
         { // Opera Bookmark
                return !addToFav(url,title)
            }
            else
            {
             window.sidebar.addPanel(title, url,"");
          return false;
            alert('Press CTRL+D to bookmark the page'); 
            }
        }
    </script>

<body>
<form runat ="server" >
<a href="" title="" rel="sidebar" onclick="return Add_Bookmark_Favorite(location.href, document.title);">Bookmark </a>
</form>
</body>
</html>

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.