Re: [Cascavel-pm] Contador Web de usuários OnLine

Rui Fernandes ruifernandes em tvtel.pt
Quarta Junho 22 12:28:58 PDT 2005


> So salientando: Javascript não tem acesso a nenhuma informação a mais do
> cliente além do navegador, resolução e coisas do gênero, nem o IP ele
> fornece isso é uma escolha  dos seus desenvolvedores por questão de
> segurança.

Eis um exemplo de como o javascript pode ler o IP do utilizador, mas apenas
em Netsacape com java activado, utilizando o
java.net.InetAddress.getLocalHostName() ou o
java.net.InetAddress.getLocalHost()

:

<BODY>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
netscapeTest = parseInt(navigator.appVersion)
explorerTest = navigator.appName.indexOf("Microsoft") + 1
function netscapeThree() {
if (navigator.javaEnabled()) {
userDomain = java.net.InetAddress.getLocalHostName()
txt = "I bet your hostname is " + (userDomain.toString()) + " !";
} else {
txt = "You are browsing without Java enabled and therefore I can\'t find out
what your hostname is.";
   }
}
function netscapeFour() {
if (navigator.javaEnabled()) {
baseAddress = java.net.InetAddress.getLocalHost()
userDomain = baseAddress.getHostName()
txt = "I bet your hostname is " + (userDomain.toString()) + " !";
} else {
txt = "You are browsing without Java enabled and therefore I can\'t find out
what your hostname is."; }
}
if ((explorerTest == "0") && (netscapeTest == "3")) { netscapeThree() }
else if ((explorerTest == "0") && (netscapeTest == "4")) { netscapeFour() }
else {
txt = "It appears you are using Internet Explorer - and we can not find your
hostname in that browser."
}
alert(txt)
// End -->
</SCRIPT>


Cptos

Rui Fernandes




> --------------------------------------
> glasswalk3r em yahoo.com.br
> http://www.imortais.cjb.net
> -----------------------------------------------------------------------
> A well-used door needs no oil on its hinges.
> A swift-flowing stream does not grow stagnant.
> Neither sound nor thoughts can travel through a vacuum.
> Software rots if not used.
> These are great mysteries -- The Tao Of Programming, 5.1
>
>
>
>
>
> _______________________________________________________
> Yahoo! Acesso Grátis - Internet rápida e grátis.
> Instale o discador agora! http://br.acesso.yahoo.com/
> _______________________________________________
> Cascavel-pm mailing list
> Cascavel-pm em pm.org
> http://mail.pm.org/mailman/listinfo/cascavel-pm
>
> _______________________________________________
> Cascavel-pm mailing list
> Cascavel-pm em pm.org
> http://mail.pm.org/mailman/listinfo/cascavel-pm
>




Mais detalhes sobre a lista de discussão Cascavel-pm