TechSpot

Add to Favorites script

By thewolfe
Jul 19, 2002
  1. Add to Favorites script

    I would like to use the following script for "bookmarks" because you can use it with Explorer and Netscape. However, when I just add the script into the body it automatically inserts a "Click here to bookmark this page!" text and puts it at the top of the page.

    How do I change the script so that I can hyperlink my text at the location I want to put it. Also, what URL: do I use to link to.

    Here's the script.......

    http://www.simplythebest.net/scripts/_javascript_100.html

    This script opens the "Add to favorites" window in Internet Explorer, but displays a "Remember to bookmark" message in Netscape.

    EXAMPLE

    // Courtesy of SimplytheBest.net (http://simplythebest.net/info/dhtml_scripts.html) Click here to bookmark this page!

    Netscape users should see the message "Remember to bookmark this page! (CTRL-D)".


    1) Insert the below script in the <BODY> section where you want the bookmark message to appear on your page

    <SCRIPT language="_JavaScript">
    // Courtesy of SimplytheBest.net (http://simplythebest.net/info/dhtml_scripts.html)
    <!--
    if (navigator.appName == 'Microsoft Internet Explorer' &&
    parseInt(navigator.appVersion) >= 4)
    {
    document.write('<font face=\"arial\" size=\"2\"><b><a href=\"#\" onfiltered=\"_javascript:window.external.AddFavorite(location.href,document.title)\">');
    document.write('Click here to bookmark this page!</a></font></b>');
    }else
    {var msg = "Remember to bookmark this page!";
    if(navigator.appName == "Netscape") msg += " (CTRL-D)";
    document.write(msg);
    }
    // -->
    </SCRIPT>



    2) Define the message and the style of the link in this section of the script:

    document.write('<font face=\"Arial\" size=\"2\"><b><a href=\"#\" onfiltered=\"_javascript:window.external.AddFavorite(location.href,document.title)\">');
    document.write('Click here to bookmark this page!</a></font></b>');
    }else
    {var msg = "Remember to bookmark this page!";
    if(navigator.appName == "Netscape") msg += " (CTRL-D)";
     
  2. thewolfe

    thewolfe TS Rookie Topic Starter Posts: 287

    Got it from another site. Thanks
     
  3. Phantasm66

    Phantasm66 TS Rookie Posts: 6,504   +6

    care to share, then? if it was important enough to post about its important enough to share the solution...
     
  4. thewolfe

    thewolfe TS Rookie Topic Starter Posts: 287

    Sure. It was almost to simple. The way the script is set up, all you have to do is insert the text at the exact spot that you want the 'Click here to book mark this page! text to show up.

    My dilemma was figuring out where exactly to paste text. But since I had additional text in that area on my page I could figure it out from that.

    You can then change that verbiage to whatever you want.

    You do not have to hyperlink because it does it for you.

    If my explanation is lacking, post again and I'll try it again.
     
Topic Status:
Not open for further replies.


Add New Comment

TechSpot Members
Login or sign up for free,
it takes about 30 seconds.
You may also...


Get complete access to the TechSpot community. Join thousands of technology enthusiasts that contribute and share knowledge in our forum. Get a private inbox, upload your own photo gallery and more.