Thanks Randy,
I just put this very simple web page together and sure, enough on
XP/SP2 IE6 I get a 'lan'
in my IE status bar. (lower/left of browser). Check it out. Also be
weary of any funky line breaks you may get from copying / pasting.
This was included in Script block inside the page's <BODY> tag. Hope
you get positive results out of it.
//Connection Detection v2
var SSClientCaps_wait_interval_01 = null;
var SSModemFound = null;
function SSClientCapsWaitForDOM() {
// need to wait for document before looking up clientCaps
properties
if (document.readyState != "interactive" && document.readyState
!= "complete")
return;
var bodyObjArray = document.getElementsByTagName("body");
var bodyObj = bodyObjArray[0];
if (!bodyObj)
return;
clearInterval(SSClientCaps_wait_interval_01);
bodyObj.style.behavior = "url(#default#clientCaps)";
window.status = bodyObj.connectionType;
if (bodyObj.connectionType!="lan" &&
bodyObj.connectionType!="offline"){
SSModemFound = true;
}
else
{
//nothing.
}
}//end SSClientCapsWaitForDOM()
function SSIntSetter(){
SSClientCaps_wait_interval_01 =
setInterval("SSClientCapsWaitForDOM()", 50);
}//end SSIntSetter
SSIntSetter(); //begins bandwidth detection
</Script>
=======================================
Randy Webb wrote:[color=blue]
> But it didn't.[/color]
It should now.[color=blue]
>
beholdthepanda@gmail.com said the following on 12/16/2005 2:39 PM:
>
> Please quote what you are replying to.
>
> If you want to post a followup via groups.google.com, don't use the
> "Reply" link at the bottom of the article. Click on "show options" at
> the top of the article, then click on the "Reply" at the bottom of the
> article headers.
>[color=green]
> > I have a bit of code that will detect what type of connection the user
> > is - well - using. It can detect 3 states "modem" "lan" and "offline."[/color]
>
> For me it detects nothing.
>
>[color=green]
> > THIS ISN'T PURE JS because it uses clientcaps behavior which is only
> > supported in IE.
> >
> > For more info on this behavior check out:
> >
http://msdn.microsoft.com/workshop/a...ectiontype.asp
> >
> > A page with this code on it should be able, in IE, to detect how the
> > user got there (modem, lan or offline connection)[/color]
>
> But it didn't.
>[color=green]
> > You can pretty much see what's going on in here, you can get creative
> > anywhere after the bodyObj.style.behavior = "url(#default#clientCaps)";
> > which is where we store what connection type we get:
> >[/color]
>
> <snip>
>[color=green]
> > else
> > {[/color]
>
> alert('It didnt work')
>[color=green]
> > //nothing.
> > }
> > }//end SSClientCapsWaitForDOM()
> >[/color]
>
> <snip>
>
> Adding the alert into the else branch for testing, no matter how I
> opened the page. Locally, offline, online, from a server, in IE6 XP SP2,
> I get the "It didnt work" alert. Maybe you might try testing your code
> again.
>
> --
> Randy
> comp.lang.javascript FAQ -
http://jibbering.com/faq & newsgroup weekly
> Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/[/color]