Here I have decided to help you with how to add a bookmark by JavaScript. This JavaScript Bookmarks code works on, Opera, Firefox and Internet Explorer. It doesn't work on Chrome
Add this JavaScript code just above </head>
Add this JavaScript code inside the HTML body
Here is an example:
Remember to replace: lets forum - Community Discussion Forum Boards and http:// letsforum.com with your own title and url
Add this JavaScript code just above </head>
Code:
<script type="text/javascript" language="JavaScript">
function Bookmark() {
url = "http:// letsforum.com";
title = " lets forum - Community Discussion Forum Boards";
if(document.all){window.external.AddFavorite(url,title);}
else if(window.sidebar){window.sidebar.addPanel(title,url, "");}
else if(window.opera && window.print) { return false; }
}
function focus(){ document.myform.domainname.focus(); }
function Alert(){
alert('Your browser does not support this fuction!. Please add this bookmark manualy through bookmark menu or by pressing Ctrl+D.');
}
</script>
Add this JavaScript code inside the HTML body
Code:
<script type="text/javascript" language="JavaScript">
var bmt = "";
if(window.opera && window.print) {
document.write('<a rel="sidebar" href="http:// letsforum.com" title=" lets forum - Community Discussion Forum Boards"><strong>Bookmark Now</strong></a>');
}
else {
if(document.all){
document.write('<a rel="nofollow" href="#" onclick="javascript:Bookmark();return false;" title="Add to Favorites"><strong>Add to Favorites</strong></a>');
}
else if(window.sidebar){
document.write('<a rel="nofollow" href="#" onclick="javascript:Bookmark();return false;" title="Add to Bookmarks"><strong>Add to Bookmarks</strong></a>');
}
else{
document.write('<a rel="nofollow" href="#" onclick="javascript:Alert();return false;" title="Bookmark Now"><strong>Bookmark Now</strong></a>');
}
}
</script>
Here is an example:
Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HTML Title</title>
<script type="text/javascript" language="JavaScript">
function Bookmark() {
url = "http:// letsforum.com";
title = " lets forum - Community Discussion Forum Boards";
if(document.all){window.external.AddFavorite(url,title);}
else if(window.sidebar){window.sidebar.addPanel(title,url, "");}
else if(window.opera && window.print) { return false; }
}
function focus(){ document.myform.domainname.focus(); }
function Alert(){
alert('Your browser does not support this fuction!. Please add this bookmark manualy through bookmark menu or by pressing Ctrl+D.');
}
</script>
</head>
<body>
<script type="text/javascript" language="JavaScript">
var bmt = "";
if(window.opera && window.print) {
document.write('<a rel="sidebar" href="http:// letsforum.com" title=" lets forum - Community Discussion Forum Boards"><strong>Bookmark Now</strong></a>');
}
else {
if(document.all){
document.write('<a rel="nofollow" href="#" onclick="javascript:Bookmark();return false;" title="Add to Favorites"><strong>Add to Favorites</strong></a>');
}
else if(window.sidebar){
document.write('<a rel="nofollow" href="#" onclick="javascript:Bookmark();return false;" title="Add to Bookmarks"><strong>Add to Bookmarks</strong></a>');
}
else{
document.write('<a rel="nofollow" href="#" onclick="javascript:Alert();return false;" title="Bookmark Now"><strong>Bookmark Now</strong></a>');
}
}
</script>
</body>
</html>
Remember to replace: lets forum - Community Discussion Forum Boards and http:// letsforum.com with your own title and url