Problema com setInterval
Estou com problema para retornar o status para o action script, porque a função setInterval nao esta funcionando no firefox.
//VARIAVEIS DE CONTROLE DE STATUS DA CONEXAO var _status = navigator.onLine; function conexaoOn_fc() { return(_status); } var checarConexaoOn = window.setInterval(function() { 'aviso1_fc()' }, 2000); //enquanto estiver on var checarConexaoOf = window.setInterval(function() { 'aviso2_fc()' }, 2000); //enquanto estiver off clearInterval(checarConexaoOf) //desativa a busca online //CASO ONLINE function aviso1_fc() { _status = navigator.onLine; if(_status == false) { clearInterval(checarConexaoOn); //alert("PASSOU PARA OFFLINE"); checarConexaoOf = window.setInterval(function() { 'aviso2_fc()' }, 2000); //fica offline } } //CASO OFFLINE function aviso2_fc() { _status = navigator.onLine; if(_status == true) { clearInterval(checarConexaoOf); //alert("PASSOU PARA ONLINE"); checarConexaoOn = window.setInterval(function() { 'aviso1_fc()' }, 2000); //fica online } }
Estou com problema para retornar o status para o action script, porque a função setInterval nao esta funcionando no firefox.
<pre><nowiki>//VARIAVEIS DE CONTROLE DE STATUS DA CONEXAO
var _status = navigator.onLine;
function conexaoOn_fc()
{
return(_status);
}
var checarConexaoOn = window.setInterval(function() { 'aviso1_fc()' }, 2000); //enquanto estiver on
var checarConexaoOf = window.setInterval(function() { 'aviso2_fc()' }, 2000); //enquanto estiver off
clearInterval(checarConexaoOf) //desativa a busca online
//CASO ONLINE
function aviso1_fc()
{
_status = navigator.onLine;
if(_status == false)
{
clearInterval(checarConexaoOn);
//alert("PASSOU PARA OFFLINE");
checarConexaoOf = window.setInterval(function() { 'aviso2_fc()' }, 2000); //fica offline
}
}
//CASO OFFLINE
function aviso2_fc()
{
_status = navigator.onLine;
if(_status == true)
{
clearInterval(checarConexaoOf);
//alert("PASSOU PARA ONLINE");
checarConexaoOn = window.setInterval(function() { 'aviso1_fc()' }, 2000); //fica online
}
}</nowiki></pre>
Modified