Error: uncaught exception: Permission denied to get property Window.processXML

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">&nbsp;&nbsp;
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>
 
D

Daz

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">&nbsp;&nbsp;
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>

It's a cross domain issue. You can't access the document of a frame if
it's loaded from a domain that's different from the original page
location. The are hacks to get around it, but it's there as a security
protocol, so someone can't use JavaScript to transmit, say a password
when you enter it on another Web site.
 
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 Igetthe
followingerror:
Error:uncaughtexception:permissiondeniedtogetproperty
Window.processXML
Is there a way togetaround 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>

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 thatgetset 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:Getthe 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 togetthe 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";

//***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">&nbsp;&nbsp;
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="GetMap 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>

It's a cross domain issue. You can't access the document of a frame if
it's loaded from a domain that's different from the original page
location. The are hacks togetaround it, but it's there as a security
protocol, so someone can't use JavaScript to transmit, say a password
when you enter it on another Web site.

So it sounds like the issue locally is that I don't have a domain when
the source is say file://C:/js/files/deafult.htm. Does that sound
correct?
Does one of the hacks involve using 'document.domain'? Could you point
me in the right direction to track down a hack that would allow me to
run locally instead of from a server?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,737
Latest member
Georgeengab

Latest Threads

Top