XMLHttpRequest
From Fxp Wiki
- From: [1]
- in about:config filter through "signed", and set signed.applets.codebase_principal_support to true
- Create a user.js in profile directory with
user_pref(”capability.policy.XMLHttpRequestToAnySite.XMLHttpRequest.open”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.sites”, “http://localhost:8080”); user_pref(”capability.policy.policynames”, “XMLHttpRequestToAnySite”);
Actually, you have to insert one by one to the prefs.js (through the about:config interface), all the line herafter:
user_pref(”capability.policy.XMLHttpRequestToAnySite.XMLHttpRequest.open”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.sites”, “http://localhost:8080”); user_pref(”capability.policy.XMLHttpRequestToAnySite.CDATASection.nodeValue”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Element.attributes”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Element.childNodes”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Element.firstChild”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Element.getAttribute”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Element.getElementsByTagName”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Element.lastChild”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Element.nodeName”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Element.nodeType”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Element.parentNode”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Element.tagName”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Element.nextSibling”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Element.previousSibling”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.HTMLCollection.length”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.HTMLCollection.item”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Text.attributes”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Text.childNodes”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Text.firstChild”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Text.getAttribute”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Text.getElementsByTagName”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Text.lastChild”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Text.nodeName”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Text.nodeType”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Text.parentNode”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Text.tagName”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Text.nextSibling”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.Text.previousSibling”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.XMLDocument.documentElement”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.XMLDocument.getElementsByTagName”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.XMLHttpRequest.channel”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.XMLHttpRequest.open”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.XMLHttpRequest.responseText”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.XMLHttpRequest.responseXML”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.XMLHttpRequest.send”, “allAccess”); user_pref(”capability.policy.XMLHttpRequestToAnySite.XMLHttpRequest.setRequestHeader”, “allAccess”); user_pref(”capability.policy.policynames”, “XMLHttpRequestToAnySite”);
Call on eXist xml database
<html>
<head>
<!--http://www.w3schools.com/XML/tryit.asp?filename=tryxml_httprequest_js4 -->
<script type="text/javascript">
var xmlhttp;
function loadXMLDoc(url)
{
xmlhttp=null;
if (window.XMLHttpRequest)
{// code for IE7, Firefox, Mozilla, etc.
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{// code for IE5, IE6
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp!=null)
{
xmlhttp.onreadystatechange=onResponse;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
else
{
alert("Your browser does not support XMLHTTP.");
}
}
function onResponse()
{
if(xmlhttp.readyState!=4) return;
if(xmlhttp.status!=200)
{
alert("Problem retrieving XML data");
return;
}
txt="<table border='1'>";
y=xmlhttp.responseText;
xmlstring = "<xml>"+y+"</xml>";
var xmlobject = (new DOMParser()).parseFromString(xmlstring, "text/xml");
x=xmlobject.getElementsByTagName("SPEECH");
//x=xmlhttp.responseXML.documentElement.getElementsByTagNameNS("http://exist.sourceforge.net/NS/exist","exist:SPEECH");
for (i=0;i<x.length;i++)
{
txt=txt + "<tr>";
xx=x[i].getElementsByTagName("SPEAKER");
{
try
{
txt=txt + "\n<td>" + xx[0].firstChild.nodeValue + "</td>";
txt=txt + "<td>";
}
catch (er)
{
txt=txt + "<td> </td>";
}
}
xx=x[i].getElementsByTagName("LINE");
{
try
{
for (j=0;j<xx.length;j++)
{
txt=txt + "<br />" + xx[j].firstChild.nodeValue + "";
}
}
catch (er)
{
txt=txt + "<td> </td>";
}
}
txt=txt + "</td>";
txt=txt + "</tr>";
}
txt=txt + "</table>";
document.getElementById('copy').innerHTML=txt;
}
</script>
</head>
<body>
<div id="copy">
<button onclick="loadXMLDoc('http://localhost:8080/eXist-1.2-cocoon-2.1.11/rest/db/shakespeare?_query=//SPEECH[SPEAKER=%22JULIET%22]&_start=1&_howmany=10&_encoding=utf-8&_wrap=no')">Get CD info</button>
</div>
</body>
</html>
Date: May/23/2008
