F
funktacular
Hi -
I have some javascript that works when I run it from a server, but I
need to run it locally. When I try to execute it locally I get the
following error:
Error: uncaught exception: Permission denied to get property
Window.processXML
Is there a way to get around this issue?
default.htm
::::::::::::::::::::::::::::::::::::::::::::::::::
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<html>
<TITLE>Exercise #3 - Request/Response Application</TITLE>
<!-- frames -->
<FRAMESET ROWS="*,20">
<FRAME NAME="InputFrame" SRC="InputForm.htm" >
<FRAME NAME="PostFrame" SRC="postForm.htm" SCROLLING="no"
NORESIZE>
</FRAMESET>
</HTML>
::::::::::::::::::::::::::::::::::::::::::::::::::
InputForm.htm
::::::::::::::::::::::::::::::::::::::::::::::::::
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<HTML>
<HEAD>
<TITLE>Input Form</TITLE>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
// Global variables that get set when the frames are loaded
var theInputFormOBJ;
var theHost;
//function that populates global variables
function init(){
theInputFormOBJ = document.theInputForm;
theHost = "bugjuice";
//set default host and ArcIMS Service values
theInputFormOBJ.Service.value = "test2";
theInputFormOBJ.Host.value = theHost;
}
// clear the response box
function clearResponse() {
theInputFormOBJ.Response.value = "";
}
function sendXML() {
alert ("send XML");
//***Exercise 03, Step 05.2: Get the value of the service name and
the request from "theInputForm" and put
// them in variables called theService and theRequest respectively
var theService = theInputFormOBJ.Service.value;
var theRequest = theInputFormOBJ.Request.value;
//***Exercise 03, Step 05.3: Construct the action for the
"theInputForm" and put the value in a variable
// called actionURL (HINT: The action is a URL made up of the host
name and
//a call to the servlet. The argument/value pairs that are
included in the
// URL are ServiceName, ClientVersion and Form).
var esrimapBlurb = "/servlet/com.esri.esrimap.Esrimap";
var cVersion = "?ClientVersion=9.0";
theService = "&ServiceName=" + theService;
var theForm = "&Form=True";
var actionURL = "http://" + theHost + esrimapBlurb + cVersion +
theService + theForm;
alert (actionURL);
//***Exercise 03, Step 05.4: Use the DOM to get the form object in
the PostFrame and store it in a variable
// called thePostFormOBJ
var thePostFormOBJ = parent.PostFrame.document.forms[0];
//***Exercise 03, Step 05.5: Set the action attribute of
thePostFormOBJ to be the value of the actionURL
// variable that you populated earlier.
thePostFormOBJ.action=actionURL;
//***Exercise 03, Step 05.6: Set the XMLRequest INPUT element of
thePostFormOBJ to
// be the value of the theRequest variable that you populated
earlier.
thePostFormOBJ.ArcXMLRequest.value= theRequest;
//***Exercise 03, Step 05.7: Set the JavaScriptFunction attribute
of thePostFormOBJ to
//be "parent.InputFrame.processXML".
thePostFormOBJ.JavaScriptFunction.value =
"parent.InputFrame.processXML";
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserAccess")
netscape.security.PrivilegeManager.enablePrivilege("UniversalPreferencesRead")
netscape.security.PrivilegeManager.enablePrivilege("UniversalPreferencesWrite")
//***Exercise 03, Step 05.8: submit thePostFormOBJ
thePostFormOBJ.submit();
}
function processXML(theReply){
//***Exercise 03, Step 06.1: Update the text area with the response
theInputFormOBJ.Response.value = theReply;
}
function writeGetImage(){
//Build GET_IMAGE request
//<?xml version="1.0" encoding="UTF-8" ?>
//<ARCXML version="1.1">
//<REQUEST>
//<GET_SERVICE_INFO renderer="false" extensions="false"
fields="false" />
//</REQUEST>
//</ARCXML>
var getImageReq = '<?xml version="1.0" encoding="UTF-8" ?>\n';
getImageReq = getImageReq + '<ARCXML version="1.1">\n';
getImageReq = getImageReq + '<REQUEST>\n';
getImageReq = getImageReq + '<GET_SERVICE_INFO renderer="false"
extensions="false" fields="false" />\n';
getImageReq = getImageReq + '</REQUEST>\n';
getImageReq = getImageReq + '</ARCXML>';
//Put request in Request text area
theInputFormOBJ.Request.value = getImageReq;
}
</SCRIPT>
</HEAD>
<BODY BgColor="#CCCCCC" onLoad="init()">
<FORM name="theInputForm">
Host: <INPUT TYPE="Text" NAME="Host" VALUE="" size="20">
ArcIMS Service: <INPUT TYPE="Text" NAME="Service" VALUE="" size="20">
<BR><BR>
Request:<BR>
<TEXTAREA COLS=80 ROWS=15 NAME="Request" WRAP="soft" ></TEXTAREA><BR>
<!--***Exercise 03, Step 05.1: Use an onClick event in this element
to call a function named sendXML(). -->
<INPUT TYPE="button" NAME="theSendButton" VALUE="Send Request"
onClick="sendXML()">
<INPUT TYPE="button" NAME="getImage" VALUE="Get Map Service"
onClick="writeGetImage()"><BR>
Response:<BR>
<TEXTAREA COLS=80 ROWS=10 NAME="Response" WRAP="soft"></TEXTAREA><BR>
<INPUT TYPE="button" NAME="theClearButton" VALUE="Clear Response"
onClick="clearResponse()">
</FORM>
</BODY>
</HTML>
::::::::::::::::::::::::::::::::::::::::::::::::::
postForm.htm
::::::::::::::::::::::::::::::::::::::::::::::::::
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<HTML>
<HEAD>
<TITLE>Post Form</TITLE>
</HEAD>
<BODY BGCOLOR="#CCCCCC" >
<!--***Exercise 03, Step 03.2: Use the FORM element to create a form
with an empty action attribute and a method
attribute that has a value of POST-->
<FORM action="" method="POST">
<!--***Exercise 03, Step 03.3: Create 4 hidden INPUT elements -->
<INPUT TYPE="Hidden" NAME="ArcXMLRequest" VALUE="">
<INPUT TYPE="Hidden" NAME="JavaScriptFunction"
VALUE="parent.InputFrame.processXML">
<INPUT TYPE="Hidden" NAME="BgColor" VALUE="#CCCCCC">
<INPUT TYPE="Hidden" NAME="FormCharset" VALUE="UTF-8">
</FORM>
</BODY>
</HTML>
I have some javascript that works when I run it from a server, but I
need to run it locally. When I try to execute it locally I get the
following error:
Error: uncaught exception: Permission denied to get property
Window.processXML
Is there a way to get around this issue?
default.htm
::::::::::::::::::::::::::::::::::::::::::::::::::
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<html>
<TITLE>Exercise #3 - Request/Response Application</TITLE>
<!-- frames -->
<FRAMESET ROWS="*,20">
<FRAME NAME="InputFrame" SRC="InputForm.htm" >
<FRAME NAME="PostFrame" SRC="postForm.htm" SCROLLING="no"
NORESIZE>
</FRAMESET>
</HTML>
::::::::::::::::::::::::::::::::::::::::::::::::::
InputForm.htm
::::::::::::::::::::::::::::::::::::::::::::::::::
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<HTML>
<HEAD>
<TITLE>Input Form</TITLE>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
// Global variables that get set when the frames are loaded
var theInputFormOBJ;
var theHost;
//function that populates global variables
function init(){
theInputFormOBJ = document.theInputForm;
theHost = "bugjuice";
//set default host and ArcIMS Service values
theInputFormOBJ.Service.value = "test2";
theInputFormOBJ.Host.value = theHost;
}
// clear the response box
function clearResponse() {
theInputFormOBJ.Response.value = "";
}
function sendXML() {
alert ("send XML");
//***Exercise 03, Step 05.2: Get the value of the service name and
the request from "theInputForm" and put
// them in variables called theService and theRequest respectively
var theService = theInputFormOBJ.Service.value;
var theRequest = theInputFormOBJ.Request.value;
//***Exercise 03, Step 05.3: Construct the action for the
"theInputForm" and put the value in a variable
// called actionURL (HINT: The action is a URL made up of the host
name and
//a call to the servlet. The argument/value pairs that are
included in the
// URL are ServiceName, ClientVersion and Form).
var esrimapBlurb = "/servlet/com.esri.esrimap.Esrimap";
var cVersion = "?ClientVersion=9.0";
theService = "&ServiceName=" + theService;
var theForm = "&Form=True";
var actionURL = "http://" + theHost + esrimapBlurb + cVersion +
theService + theForm;
alert (actionURL);
//***Exercise 03, Step 05.4: Use the DOM to get the form object in
the PostFrame and store it in a variable
// called thePostFormOBJ
var thePostFormOBJ = parent.PostFrame.document.forms[0];
//***Exercise 03, Step 05.5: Set the action attribute of
thePostFormOBJ to be the value of the actionURL
// variable that you populated earlier.
thePostFormOBJ.action=actionURL;
//***Exercise 03, Step 05.6: Set the XMLRequest INPUT element of
thePostFormOBJ to
// be the value of the theRequest variable that you populated
earlier.
thePostFormOBJ.ArcXMLRequest.value= theRequest;
//***Exercise 03, Step 05.7: Set the JavaScriptFunction attribute
of thePostFormOBJ to
//be "parent.InputFrame.processXML".
thePostFormOBJ.JavaScriptFunction.value =
"parent.InputFrame.processXML";
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserAccess")
netscape.security.PrivilegeManager.enablePrivilege("UniversalPreferencesRead")
netscape.security.PrivilegeManager.enablePrivilege("UniversalPreferencesWrite")
//***Exercise 03, Step 05.8: submit thePostFormOBJ
thePostFormOBJ.submit();
}
function processXML(theReply){
//***Exercise 03, Step 06.1: Update the text area with the response
theInputFormOBJ.Response.value = theReply;
}
function writeGetImage(){
//Build GET_IMAGE request
//<?xml version="1.0" encoding="UTF-8" ?>
//<ARCXML version="1.1">
//<REQUEST>
//<GET_SERVICE_INFO renderer="false" extensions="false"
fields="false" />
//</REQUEST>
//</ARCXML>
var getImageReq = '<?xml version="1.0" encoding="UTF-8" ?>\n';
getImageReq = getImageReq + '<ARCXML version="1.1">\n';
getImageReq = getImageReq + '<REQUEST>\n';
getImageReq = getImageReq + '<GET_SERVICE_INFO renderer="false"
extensions="false" fields="false" />\n';
getImageReq = getImageReq + '</REQUEST>\n';
getImageReq = getImageReq + '</ARCXML>';
//Put request in Request text area
theInputFormOBJ.Request.value = getImageReq;
}
</SCRIPT>
</HEAD>
<BODY BgColor="#CCCCCC" onLoad="init()">
<FORM name="theInputForm">
Host: <INPUT TYPE="Text" NAME="Host" VALUE="" size="20">
ArcIMS Service: <INPUT TYPE="Text" NAME="Service" VALUE="" size="20">
<BR><BR>
Request:<BR>
<TEXTAREA COLS=80 ROWS=15 NAME="Request" WRAP="soft" ></TEXTAREA><BR>
<!--***Exercise 03, Step 05.1: Use an onClick event in this element
to call a function named sendXML(). -->
<INPUT TYPE="button" NAME="theSendButton" VALUE="Send Request"
onClick="sendXML()">
<INPUT TYPE="button" NAME="getImage" VALUE="Get Map Service"
onClick="writeGetImage()"><BR>
Response:<BR>
<TEXTAREA COLS=80 ROWS=10 NAME="Response" WRAP="soft"></TEXTAREA><BR>
<INPUT TYPE="button" NAME="theClearButton" VALUE="Clear Response"
onClick="clearResponse()">
</FORM>
</BODY>
</HTML>
::::::::::::::::::::::::::::::::::::::::::::::::::
postForm.htm
::::::::::::::::::::::::::::::::::::::::::::::::::
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<HTML>
<HEAD>
<TITLE>Post Form</TITLE>
</HEAD>
<BODY BGCOLOR="#CCCCCC" >
<!--***Exercise 03, Step 03.2: Use the FORM element to create a form
with an empty action attribute and a method
attribute that has a value of POST-->
<FORM action="" method="POST">
<!--***Exercise 03, Step 03.3: Create 4 hidden INPUT elements -->
<INPUT TYPE="Hidden" NAME="ArcXMLRequest" VALUE="">
<INPUT TYPE="Hidden" NAME="JavaScriptFunction"
VALUE="parent.InputFrame.processXML">
<INPUT TYPE="Hidden" NAME="BgColor" VALUE="#CCCCCC">
<INPUT TYPE="Hidden" NAME="FormCharset" VALUE="UTF-8">
</FORM>
</BODY>
</HTML>