Microsoft.com and Opera Conflic... Evil scheme?
Well, surfing to www.microsoft.com in Opera 5.12, something weird happens whenever I click a link in the left menubar area. Some funny Javascript stuff happens, and Opera starts trying to reload the page hundreds of times a minute. The "stop" button doesn't affect it. Needless to say, this renders the current Opera window a tad unusable, and bandwidth is eaten.
In the main page, the code for the link I clicked (happens with some others) is:
Code:
</td></tr></table>
<table width="176" cellpadding="0" cellspacing="0" border="0"><tr><td class="flyoutLink"
onclick="Flyout_S3_Node1.click();">
<A onclick="javascript:trackInfo(this);" LinkArea="Flyout"
ID="Flyout_S3_Node1" LinkID="Flyout_S3_Node1"
HREF="http://support.microsoft.com/directory/">
Support</A>
Opera seems to indicate that it is trying to load the href= referenced address. But it keeps doing it over... and over... Now, if I enter in http://support.microsoft.com/directory/ all by itself into my address bar, it works without a hitch. Therefore I think the problem is with the javascript, and more specifically, in the javascript:trackInfo(this); section, because the function trackInfo(); is found within "ctredir.js", sounds like redir is for 'redirect' to me...
Code:
<BODY onload="loadPage(100, 1000);"
BGCOLOR="#FFFFFF" TOPMARGIN="0" LEFTMARGIN="0"
MARGINWIDTH="0" MARGINHEIGHT="0" TEXT="#000000">
<script language="JavaScript" src="/library/include/ctredir.js">
</script>
Which, as you can see, is loaded. Now, WITHIN ctredir.js, I find:
PHP Code:
function trackInfo(objLink)
{
if (!objLink) return;
if (!objLink.LinkID || !objLink.href) return;
var LinkText = (objLink.innerText)?objLink.innerText:objLink.all(0).alt;
if (!LinkText || typeof(LinkText)=="undefined") return;
LinkText = jsTrim(LinkText);
if (LinkText=="") return;
// override link's HREF and send on its way
// For Link Text - take innerText if available, or ALT if image
// Sometimes with slow browser reaction and rapid clicks this can get called more than once -
// ensure there's no repetition.
if (objLink.href.toString().indexOf("CTRedir") < 0)
objLink.href = "/isapi/CTRedir.asp?type=CT&source=WWW&sPage="
+ ((objLink.LinkID)?escape(objLink.LinkID):"") + "|"
+ ((objLink.LinkArea)?escape(objLink.LinkArea):"") + "|"
+ ((objLink.LinkGroup)?escape(objLink.LinkGroup):"") + "|"
+ escape(LinkText)
+ "&tPage=" + objLink.href;
}
Anyone have some Javascript experience, and could possibly enlighten me on this? AFAIK this is new, I don't recall having major problems with M$'s site with Opera before.
Edit: Edited so smileys are disabled... one or two weird things caused by them, also tried to remove the super-long lines that extended browser windows.
Microsoft web programmers need to read a book
Someone at microsoft doesn't know how to write code...
function findDIV(x)
{
var oDiv = document.all.tags("DIV");
var iDiv;
if (oDiv != null)
{
iDiv = oDiv.length;
for (var i=0; i<iDiv; i++)
{
if(oDiv[i].contains(x))
{
return oDiv[i];
}
}
}
}
Can anyone tell me what's wrong with this FUNCTION? (Remember, functions are supposed to return something. What happens if oDiv[i].contains(x) = false?). See, this is why I like compilers because you catch these errors. The error I get is 'function does not always return a value'. So I am assuming it is NOT returning a value in my case.
This specifically caused problems with my browser (Netscape 4.03). It basically was maxing out my cpu and crashing netscape.
The way I see it is that their fancy menu bar calls this function but since my netscape doesn't support divs (i'm assuming, not quite sure though), either oDiv[i].contains(x) returns false OR oDiv = null (obviously otherwise this function would've returned something).
Not sure if this is on topic or not but I hate sloppy code, it's one of my pet peeves.