26 September, 2005

Bookmarking Pages with JavaScript

0 Comments

Written by Jason Davies Topics: JavaScript

Internet Explorer Only

Sorry folks, that's life! This can only be done in Microsoft Internet Explorer. In this example we only show the bookmark link if the browser is Internet Explorer.

The Example

<script type="text/javascript">
    <!--
        if (document.all) {
            document.write("<a href="javascript:window.external.AddFavorite(location.href, 'Bookmarking with JavaScript')">Bookmark this page</a>");
        } else {
            document.write("Sorry, Microsoft Internet Explorer is needed for this example");
        }
    //-->
</script>

The JavaScript Code

<script type="text/javascript">
    <!--
        if (document.all) {
            document.write("<a href="javascript:window.external.AddFavorite(location.href, 'Bookmarking with JavaScript')">Bookmark this page</a>");
        } else {
            document.write("Sorry, Microsoft Internet Explorer is needed for this example");
        }
    //-->
</script>

0 Responses to “Bookmarking Pages with JavaScript”

Leave a Comment