HOW TO

Add bookmarks to ArcIMS Websites and Extents using HTML viewer

Last Published: April 25, 2020

Summary

This article describes how to add bookmark functionality to an ArcIMS website. This functionality will allow users to bookmark the whole ArcIMS website or a particular extent, which respects the visible layers and active layer settings of that extent.

The procedure shows how to implement example bookmark code in a 'vanilla' or out of the box HTML viewer.

Note:
Though the included sample code can be implemented in all browsers, the functionality will only work with Internet Explorer. For all the other browsers, the bookmark option is not shown.

Procedure

A good place to add the bookmarks is in top frame of the HTML viewer where the title of the site is shown.

  1. Open file top.htm in any text editor. Location of top.htm is directly under <website> directory.
  2. Find the following lines of code at the bottom of the file:

    Code:
    <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
    document.writeln(theTitle);
    </SCRIPT>
    </B></FONT>

    </BODY>
    </HTML>

    Add these lines before the </BODY> tag.

    Code:
    <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
    if (window.external) { // Check for browser - IE only
    document.writeln('<span onclick="javascript:bookmarkExtent();" style="cursor:pointer;">[ Bookmark Extent ]</span>');
    document.writeln('<span onclick="javascript:bookmarkSite();" style="cursor:pointer;"> [ Bookmark Site ]</span>');
    }
    </SCRIPT>

  3. In the same file, find the following lines of code:

    Code:
    function showInfo() {
    if (parent.TextFrame!=null) {
    parent.TextFrame.document.location="arcimsInfo.htm";
    } else {
    var Win1 = open("arcimsInfo.htm","InfoWindow","width=575,height=150,scrollbars=yes,resizable=yes");
    }
    }

    </SCRIPT>
    </HEAD>

    Add the following line before the </SCRIPT> tag:

    Code:
    function bookmarkExtent() {
    var t=parent.MapFrame;
    var bmExtent = "?box="+t.eLeft+":" + t.eBottom + ":" + t.eRight + ":" + t.eTop;
    var bmLayers = "&Layers=" + getLayersVisibilityStatus();
    var bmActiveLayer = "&ActiveLayer=" + t.ActiveLayerIndex;

    //Change the site to reflect your website entry page
    var site = "http://nandi/website/test/default.htm";

    // Change the title if needed
    var title = "NorthAmerica Saved Extents";

    if (window.external) // IE
    window.external.AddFavorite(site+bmExtent+bmLayers+bmActiveLayer,title);
    }

    function bookmarkSite() {

    // Change the title if needed
    var title = "NorthAmerica - ArcIMS Map Service";

    // Change the site to reflect your webite
    var site = "http://nandi/website/test/default.htm";

    if (window.external) // IE
    window.external.AddFavorite(site, title);
    }

    function getLayersVisibilityStatus() {
    var t=parent.MapFrame;
    var visibleLayers = "";
    for (var i=0;i<t.layerCount;i++) {
    if (t.LayerVisible[i]==1)
    visibleLayers += "1";
    else
    visibleLayers += "0";
    }
    return visibleLayers;
    }

  4. Once the new code is added, find variable called 'site' in the functions bookmarkSite and bookmarkExtent:

    Code:
    //Change the site to reflect your website
    var site = "http://nandi/website/test/default.htm";

    Make the changes so that it points to the current website.

Article ID:000008107

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic