浏览器 跨域仿问

一种是修改firefox的设置,在firefox的地址栏中输入“about:config”,并找到signed.applets.codebase_principal_support,将其设为true。

还有就是

使用编程的方法,在访问其它域之前,可以使用如下代码打开权限:

try
{
    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
}
catch (exception)
{
    alert(exception);
}




SRGAjax.sendRequest = function (strXml) {
var reqXml = null;
var urlXml = "/voice/voice.html";
xmlhttp = getRequestAjax();
if (!xmlhttp) return null;

if (navigator.userAgent.toLowerCase().indexOf("msie") > -1) {
xmlhttp.open("POST", urlXml, false);
   
xmlhttp.setRequestHeader("Method", "POST " + urlXml + " HTTP/1.1");
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
var domObj = xmlhttp.responseText;
if (domObj) {
reqXml = SRGAjax.parseNetConfMsg(domObj);
} else {
var msg = "XML\u6570\u636e\u683c\u5f0f\u9519\u8bef\uff0c\u539f\u59cb\u6587\u672c\u5185\u5bb9\u4e3a\uff1a" + xmlhttp.responseText;
alertMsg(msg, "ERROR");
}
} else {
Ext.MessageBox.alert(
sweb_common.msg_title_warnning,
sweb_common.msg_title_warnningInfo,
function(btn, text) {
window.location.href = 'login.html';
});
}
}
};

xmlhttp.send(strXml);
} else {
try {
    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
} catch (exception){
alert(exception);
}
try {
    xmlhttp.open("POST", urlXml, false);
   
xmlhttp.setRequestHeader("Method", "POST " + urlXml + " HTTP/1.1");
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    } catch (exception){
alert("open:   "+exception);
}
xmlhttp.send(strXml);

if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
var domObj = xmlhttp.responseText;
if (domObj) {
reqXml = SRGAjax.parseNetConfMsg(domObj);
} else {
var msg = "XML\u6570\u636e\u683c\u5f0f\u9519\u8bef\uff0c\u539f\u59cb\u6587\u672c\u5185\u5bb9\u4e3a\uff1a" + xmlhttp.responseText;
alertMsg(msg, "ERROR");
}
} else {
Ext.MessageBox.alert(
sweb_common.msg_title_warnning,
sweb_common.msg_title_warnningInfo,
function(btn, text) {
window.location.href = 'login.html';
});
}
}
}

return reqXml;
};

你可能感兴趣的:(编程,xml,ext,Security,firefox)