Prevent layer names from being displayed in an HTML Viewer's TOC

Last Published: April 25, 2020


The HTML Viewer can be easily customized to not display certain layer names in the Table of Contents (TOC).

For information on how to achieve these results in an ArcIMS 3.1, 4.0, or 4.0.1 HTML Viewer, see the Customizing HTML Viewer documentation. A custom install must be done to load this PDF file.


  1. Load the site's toc.htm file in a text editor.

  2. Find the following string:

    for (var i=0;i<theCount;i++) {

    Note the lengthy if statement below this string.

  3. Type the following line below the if statement:

    if (t.LayerName[i] != "<layer name>") {

    Where <layer name> is the layer you do not want displayed in the TOC.

    This line determines whether the layer name gets written or not.

  4. Locate the following line of code below the code you just typed:


    Type a closing parenthesis to end the if statement you typed in Step 3.

  5. Save your edits.

  6. Clear your Web browser's cache.

  7. Reload the page to test.

Article ID:000002617

  • Legacy Products

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options