/    Sign up×
Community /Pin to ProfileBookmark

JS Script locking up IE6 and Below

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”;
}
}
}
[/code]

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”);
}
[/code]

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]–>
[/code]

Anyone verify the above as vaild? Cheers.

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@omnicityMar 09.2009 — If this site is any way commercial, then you probably can't afford to give up on IE6 - the chances are that IE7 will die before IE6 does.

That is quite a lot of code - if you have nothing better, then build yourself an on-page error console and write out some debug stuff to it so that you can trace where the lock-up occurs.
Copy linkTweet thisAlerts:
@ehimeauthorMar 09.2009 — *sigh You're very right about IE6's half-life, scary as it is,

I want to redirect until I can make some no code DOC loose

page for degraded browsers. Unfortunately I've been forced

live before I got a chance to get anything seemingly worthwhile

finished. I think I'm still hovering around 80&#37; somewhere. BTW
&lt;!--[if lte IE 6]&gt;&lt;script type="text/javascript"&gt;window.open("unsupported.html",null,"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");&lt;/script&gt;&lt;![endif]--&gt;
Is valid for a redirect. Yay for a minute, I guess.
Copy linkTweet thisAlerts:
@omnicityMar 09.2009 — Your 'redirect' may not work very well, as it relies on the mechanism for pop-up windows, and will probably be blocked by some users.

Most of the equivalents will as well though...
Copy linkTweet thisAlerts:
@ehimeauthorMar 09.2009 — Well hrm. Valid point, and noted. I guess what I could do instead is use

malformed html to bring up an iframe? Problem is those are deprecated,

I'd no longer be strict.... effin IE....

Maybe META refresh/redirect to a new page?
Copy linkTweet thisAlerts:
@omnicityMar 09.2009 —  .... effin IE....
[/QUOTE]


Amen to that.


Maybe META refresh/redirect to a new page?[/QUOTE]

That sounds like a much better option.
Copy linkTweet thisAlerts:
@ehimeauthorMar 09.2009 — 
That sounds like a much better option.[/QUOTE]


Atleast its supportable, and cross browser efficient.....

Even if it only effects one type of browser and at a

certain degraded version state. :rolleyes:

So I guess,
<i>
</i>&lt;!--'if IE6&gt; / Die'--&gt;
&lt;!--[if lte IE 6]&gt;&lt;META http-equiv="refresh" content="0;
URL=http://omnisistem.com/unsupported.html"&gt; &lt;![endif]--&gt;


it is then.... ?
×

Success!

Help @ehime spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...