[英]This code works fine when opened with internet explorer but fails to work when i open it with firefox or other browsers
This code works fine when running in IE.此代码在 IE 中运行时运行良好。 I get a request asking to allow blocked content due to the use of activeX.
由于使用了 activeX,我收到一个请求,要求允许被阻止的内容。 But when I run it in firefox and other browsers.. I get nothing.
但是当我在 firefox 和其他浏览器中运行它时......我什么也没得到。 Kindly help.
请帮忙。
var httpRequest;
try
{
httpRequest = new XMLHttpRequest(); // Mozilla, Safari, etc
}
catch(trymicrosoft)
{
try
{
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(oldermicrosoft)
{
try
{
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(failed)
{
httpRequest = false;
}
}
}
if(!httpRequest)
{
alert('Your browser does not support Ajax.');
return false;
}
//===============================
// Action http_request
var finaltxt;
//do{
httpRequest.onreadystatechange = function()
{
if(httpRequest.readyState == 4)
if(httpRequest.status == 200)
{
var txt = httpRequest.responseText;
var index = txt.search(/regular/i);
var index1 = txt.search(/to see hours/i);
finaltxt = txt.substring(index,index1);
document.write("<IMG " +"SRC='web2.jpg'>");
document.write("<br>"+ finaltxt.fontsize(2) + "<br>");
return finaltxt;
}
else
return finaltxt;
}
httpRequest.open('GET','http://xyz',true);
httpRequest.send(null);
return finaltxt;
It is to be expected.这是可以预料的。 As you are using ActiveX (just for IE - Not Firefox etc).
当您使用 ActiveX(仅适用于 IE - 不是 Firefox 等)。 It is a security measure for IE.
这是 IE 的一种安全措施。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.