I'm fairly new to javascript so please forgive my errors. I want to
put a statement on a web page to let the user bookmark the page. I've
seen several different versions of this - but I can't make mine work
in IE. Here is the code:
<script language="JavaScript" type="text/javascript">
<!--
function cknav(){
var IEstring = "<a
href='javascript:window.external.addFavorite('http ://la.fooweb.com','LA
Homepage')";
IEstring += "><\/a>" ;
// IEstring += ";' title='Add to Favorites '><\/a>" ;
// IEstring += "(location.href,document.title);' title='Add to
Favorites'>Favorites<\/a>" ;
var NSstring = "Click [Ctrl + D] ";
var OPstring = "Click [Ctrl + T]";
var NSOPstring = "by returning to the main page and "
var OTHstring = "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');
var opAgent = app.indexOf('opera');
// How do I get IE to execute this ?? it doesn't seem to do
anything.
if (ieAgent!= -1) { whichString = IEstring;
document.write(whichString);
alert(whichString) }
else if (nsAgent!= -1){ whichString += NSOPstring + NSstring;
alert(whichString) }
else if (opAgent!= -1){whichString += NSOPstring + OPstring;
alert(whichString) }
}
-->
</SCRIPT>
</head>
<body>
<table width="80%" frame="border" cellspacing="3" cellpadding="3"
border="4" bgcolor="#ffffff" align="center" summary="Statement">
<tbody><tr>
<td>
<br />
<!-- Try One - IE only , gives an eror -->
<h1 class="c1"><font size="+2" color="#ff0000"><b>New Web
Address.</b></font><br /><br />
<font size="+1" color="#000000"> If you got here by the
http://nu.net/lanet link, you were redirected the NEW home
of LA http://la.fooweb.com. <U>
<span style='color:red;cursor:hand;'>
<a
href="javascript:window.external.AddFavorites('HTT P://URL.COM','SITENAME')">Bookmark
Me</a>
</span></u>
<!-- Try 2 - Great for non IE but need to know how to make IE do the
bookmark in the script -->
<br />
<h1 class="c1"><font size="+2" color="#ff0000"><b>New Web
Address.</b></font><br /><br />
<font size="+1" color="#000000"> If you got here by the
http://nu.net/lanet link, you were redirected the NEW home
of LA <a
href="http://la.fooweb.com">http://la.fooweb.com</a>. <U>
<span style='color:red;cursor:hand;'
onClick=cknav()>Bookmark this address.</span></u>
</font><br />
</h1>
</td>
</tr>
</tbody>
</table><!-- End of page content -->
</body>
</html>
TIA
Stephen