Safari中不支持编码 [英] Coding not supported in Safari
本文介绍了Safari中不支持编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下编码在IE中运行良好。我还需要在Safari中使用此代码。
The below coding works well in IE. I also need to work this code in safari.
function Transmit_SOAP()
{
if(window.ActiveXObject)
{//For IE Browsers. This coding works well in IE browsers
var tempNode=xmlSoapTemplate.selectSingleNode(pathString+"xmlDatasets");
tempNode.appendChild(xmlDataReturn.documentElement);
}
else
{//verify the code below.(Safari Support)
alert("Checking");
try{
var tempNode=xmlSoapTemplate.evaluate(pathString+"xmlDatasets", xmlSoapTemplate, null, XPathResult.ANY_TYPE,null);
}
catch (e)
{
alert(e);
}
tempNode.appendChild(xmlDataReturn.documentElement);
}
}
请核实旅行代码。显示警报后代码执行中断(正在检查);
这是使用try catch时的错误
TypeError:未定义值(表达式xmlSoapTemplate.evaluate的结果)不是对象
下面的代码是xmlSoapTemplate
Kindly verify the safari code. The code execution breaks after showing the alert("Checking");
This is the error when using try catch
TypeError: Value undefined (result of expression xmlSoapTemplate.evaluate) is not object
The below code is xmlSoapTemplate
if(window.ActiveXObject)
{
//For IE Support.
//Begin by loading up the dataform via soap request
xmlSoapTemplate=new ActiveXObject("Microsoft.XMLDOM");
xmlSoapTemplate.onreadystatechange = function () {
if (xmlSoapTemplate.readyState == 4) Transmit_SOAP()
};
xmlSoapTemplate.load("../Dataforms/soap_1.xml");
}
// For Safari Support
else
{
xmlSoapTemplate = new XMLHttpRequest();
xmlSoapTemplate.open('GET','../Dataforms/soap_1.xml', true);
xmlSoapTemplate.onreadystatechange = function() {
if (xmlSoapTemplate.readyState == 4) {
Transmit_SOAP()
}
}
xmlSoapTemplate.send();
}
推荐答案
void compatibility()
{
if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
{
Request.Browser.Adapters.Clear();
}
}
将此代码粘贴到页面加载事件
paste this code on page load event
这篇关于Safari中不支持编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文