Browse Source

Fixed AJAX initalizing in IE

Removed unused images

git-svn-id: https://svn.pioder.pl/sg-svn@25 3ed2631f-fe0d-47e0-9194-a46bc0f18ee8
master
pioder 12 years ago
parent
commit
d219fe71dd
1 changed files with 27 additions and 14 deletions
  1. +27
    -14
      robocze/script.js

+ 27
- 14
robocze/script.js View File

@ -26,22 +26,35 @@ function init() {
} }
function initAjax() { function initAjax() {
try {
if (window.XMLHttpRequest) {
ajax = new XMLHttpRequest();
ajax.overrideMimeType('text/xml');
}
else if (window.ActiveXObject)
ajax = new ActiveXObject('Microsoft.XMLHTTP');
else throw 'AJAX Error';
}
catch (e) {
return false;
try
{
ajax = new XMLHttpRequest(); // nowoczesne przegladarki
ajax.overrideMimeType('text/xml');
} }
if (!ajax) {
alert('AJAX Error');
return false;
catch(e) // IE <= 6
{
var XmlHttpVersions = [
'MSXML2.XMLHTTP.6.0',
'MSXML2.XMLHTTP.5.0',
'MSXML2.XMLHTTP.4.0',
'MSXML2.XMLHTTP.3.0',
'MSXML2.XMLHTTP',
'Microsoft.XMLHTTP'
];
for (var i=0; i < XmlHttpVersions.length && null === ajax; i++)
{
try
{
ajax = new ActiveXObject(XmlHttpVersions[i]);
} catch (e) {}
}
if (null === ajax)
{
throw new Error('AJAX Error');
}
} }
return true; return true;
} }

Loading…
Cancel
Save