I’m getting a scripting lockup for obsolete browsers IE6 and below,
something to do with my XMLHTTPRequest I’m guessing, here’s the
code.
[code]
/* Sidebar JQuery */
var isExtended = 0;
var width = 200;
var height = 800;
var slideDuration = 1000;
var opacityDuration = 1500;
function extendContract() {
if (isExtended == 0) {
sideBarSlide(0, height, 1, width);
sideBarOpacity(0, 1);
isExtended = 1;
// make expand tab arrow image face left (inwards)
$(“#sideBarTab”).children().get(0).src =
$(“#sideBarTab”).children().get(0).src.replace(/(.[^.]+)$/,
“-active$1”);
} else {
sideBarSlide(height, 0, width, 1);
sideBarOpacity(1, 0);
isExtended = 0;
// make expand tab arrow image face right (outwards)
$(“#sideBarTab”).children().get(0).src =
$(“#sideBarTab”).children().get(0).src.replace(/-active(.[^.]+)$/,
“$1”);
}
}
function sideBarSlide(fromHeight, toHeight, fromWidth, toWidth) {
$(“sideBarContents”).css({“height”: fromHeight,
“width”: fromWidth});
$(“#sideBarContents”).animate({“height”: toHeight,
“width”: toWidth},
{“queue”: false,
“duration”: slideDuration},
“linear”);
}
function sideBarOpacity(from, to) {
$(“#sideBarContents”).animate({“opacity”: to}, opacityDuration,
“linear”);
}
$(function() {
// Document is ready
$(“#sideBarTab”).hover(function() {
extendContract();
return false;
},
function() {});
});
/* Swap XMLRequest to Declared DIV Tag */
function getHttpRequest() {
var i = 0;
var end = httpRequestFns.length;
var req = null;
while (i < end) {
try {
req = httpRequestFns[i]();
getHttpRequest = httpRequestFns[i];
httpRequestFns = null;
break;
} catch (e) {
continue;
}
i++;
}
return req;
}
var httpRequestFns = [function() { return new XMLHttpRequest(); },
function() {
return new ActiveXObject(“Msxml3.XMLHTTP”);
},
function() {
return new ActiveXObject(“Msxml2.XMLHTTP”);
},
function() {
return new ActiveXObject(“Microsoft.XMLHTTP”);
},
function() {return null}];
function loadDiv(url, div) {
var req = getHttpRequest();
if (req) {
req.onreadystatechange = getProcessReqChangeFn(req, div);
req.open(“GET”, url, true);
req.setRequestHeader(“Content-Type”,
“application/x-www-form-urlencoded”);
req.setRequestHeader(“Content-Type”,
“text/xml; charset=iso-8859-9”);
req.send(null);
}
return req;
}
function getProcessReqChangeFn(req, div) {
return function() {
// only if req shows “complete”
if (req.readyState == 4) {
// only if “OK”
if (req.status == 200) {
if (document.getElementById) {
if (typeof div == “string”) {
div = document.getElementById(div);
}
div.innerHTML = req.responseText;
initLytebox();
div = null;
}
} else {
req.onreadystatechange = getProcessReqChangeFn(req, div);
// This is a true Error.html
req.open(“GET”, “error.html”, true);
req.send(null);
}
return req;
}
};
}
/* Multi-Rollover Function */
function roll(REGPath, ENHPath, prodIndex, fieldIndex) {
var thisProdShot = eval(“document.ID_” + prodIndex + “.imgBig_”
+ prodIndex);
thisProdShot.src = REGPath;
thisSwatchLength = eval(“document.ID_” + prodIndex + “.icoLength”
+ prodIndex);
for (var i = 0; i < thisSwatchLength.value; i++) {
arrowImage = eval(“document.up_arrow_” + prodIndex + “_” + i);
if (fieldIndex == i) {
arrowImage.src=”images/1up.gif”;
} else {
arrowImage.src=”images/pixel.gif”;
}
}
}
IE 6 and PRE are fairly obsolete browsers though, and I’m thinking of
just redirecting to MS’s update site, telling them to get something a
bit “Newer”. Used this to popup and tell them the goods via
unsupported.html, then redirect to a Pref’d browser aka IE7/FF3. Take
a look, I think I might want to JQuery it instead, but was a bit lost
on how to do it, I think it’s a browser.version.string then a browser.
version.number, then some random redirect code here, but whatever.
JS Redirect Because your browser sucks.
[code]
var browser = navigator.appName
var ver = navigator.appVersion
var thestart = parseFloat(ver.indexOf(“MSIE”))+1 //Start MSIE Version String
var brow_ver = parseFloat(ver.substring(thestart+4,thestart+8)) //Cut out the bit of string I need.
if ((browser==”Microsoft Internet Explorer”) && (brow_ver < 7)) //If min version IE7.
{
window.open(“unsupported.html”,null,”height=200,width=400,status=yes,toolbar=no,menubar=no,location=no”);
}
You know, I might be able to just use
[code]
<!–[if lte IE 6]><script type=”text/javascript”>window.open(“unsupported.html”,null,”height=200,width=400,status=yes,toolbar=no,menubar=no,location=no”);</script><![endif]–>
Anyone verify the above as vaild? Cheers.