English

Error: Unable to display MapService after hitting back in the browser

Error Message

The following error message occurs after clicking the Back button in the Web browser.

"Unable to display MapService after hitting back in the browser"

Cause

The HTML Viewer uses a variable called URL to store the URL location of the last image it received as a response from the ArcIMS server. If the value of this variable is null, an error displays.

Solution or Workaround

It is possible to customize the error handling by pointing the URL to the root of the Web site instead of raising an error message. For the necessary steps explained below it is assumed that the root URL of the Web site is http://www.yourwebsite.com/website/<your_client>/.

  1. Browse to <Drive>:\ArcIMS\website\<your_client>\
    and open the file aimsXML.js in a text editor.
  2. Find the function processXML(theReplyIn).
    Case 1 in this function looks like the following:

    Code:
    case 1:
    //alert ("Received:\n\n" + theReply);
    var theURL = "";
    theURL = getURL(theReply);

    //alert(theURL);
    if (theURL != "") {
    getXYs(theReply);

    document.theImage.src = theURL;

    afterMapRefresh();
    //window.onerror=resetError;
    if (toolMode==3) {
    moveLayer("theMap",hspc,vspc);
    clipLayer2("theMap",0,0,iWidth,iHeight);
    window.setTimeout('showLayer("theMap");',1000);
    if (hasLayer("theMapClicks")) {
    moveLayer("theMapClicks",hspc,vspc);
    clipLayer2("theMapClicks",0,0,iWidth,iHeight);

    }
    }

    }
    else {

    if (debugOn>0) {
    alert(msgList[14] + "\n" + theReply);
    } else {
    alert(msgList[14] + theError);

    }
    .
    ..
    ...
    .....

    Note that if the URL is null, msgList[14] is raised. msgList[14] is "Unable to display MapService".
  3. Comment out the line of code that raises the error.

    Code:
    //alert(msgList[14] + theError);

  4. Add the following line below the commented out line:

    Code:
    parent.document.location="http://www.yourwebsite.com/website/<your_client>/";

  5. Case 1 now looks like:
    Code:
    case 1:
    //alert ("Received:\n\n" + theReply);
    var theURL = "";
    theURL = getURL(theReply);

    //alert(theURL);
    if (theURL != "") {
    getXYs(theReply);

    document.theImage.src = theURL;

    afterMapRefresh();
    //window.onerror=resetError;
    if (toolMode==3) {
    moveLayer("theMap",hspc,vspc);
    clipLayer2("theMap",0,0,iWidth,iHeight);
    window.setTimeout('showLayer("theMap");',1000);
    if (hasLayer("theMapClicks")) {
    moveLayer("theMapClicks",hspc,vspc);
    clipLayer2("theMapClicks",0,0,iWidth,iHeight);

    }
    }

    }
    else {

    if (debugOn>0) {
    alert(msgList[14] + "\n" + theReply);
    } else {
    //alert(msgList[14] + theError);

    parent.document.location="http://www.yourwebsite.com/website/<your_client>/";


    }
    }

  6. Save and close the aimsXML.js file.