Forum Moderators: phranque

Message Too Old, No Replies

Making a link to bookmark your site

Does anyone know the html code for this?

         

spaceylacie

12:00 am on May 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Anyone know the html code to put on your site so people can click to bookmark?

D_Blackwell

12:09 am on May 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A search for something along the lines of "bookmark page code" will find a slew of scripts. Most will only work in IE though.

Durham_e

12:41 am on May 13, 2005 (gmt 0)

10+ Year Member



D_Blackwell is right, it is difficult to find a cross browser script.

Have used the one shown below for sometime now and seems to give something worthwhile in all browsers.

Would like to correctly atribute it, but can't remember where I got it from.

<script type="text/javascript">

var IEstring = "<a class='nav2' href='javascript:window.external.AddFavorite"
IEstring += "(location.href,document.title);'>Bookmark this page<\/a>" ;
var NSstring = "Click [Ctrl + D] to bookmark this page!";
var OTHstring = "Remember to bookmark this page!"
var whichString = OTHstring ;
var agt = navigator.userAgent.toLowerCase();
var app = navigator.appName.toLowerCase();
var ieAgent = agt.indexOf('msie');
var nsAgent = app.indexOf('netscape');

if (ieAgent!= -1) {
whichString = IEstring;
} else if (nsAgent!= -1){
whichString = NSstring;
}
document.write("" + whichString + "")
</script>

spaceylacie

3:08 am on May 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oh thanks! I actually did search for it, something like html code bookmark and couldn't find one.

spaceylacie

3:19 am on May 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey, it even works! A new toy! I guess I am spacey, I couldn't find it because I was thinking it was just html code, not a java script.