Jump to content
Fórum Script Brasil
  • 0

Redirect javascript


Carlos R JR

Question

Pessoal estou precisando de ajuda.

Estou tentando fazer um redirect em javascript mas não está funcionando.

Existe algum problema em usar o 'window.location' com o XMLHttpRequest??

Segue meu código

function login(usuario, senha, urlRedirect, msg) {

//carrega objeto de acordo com browser

var http;

if (window.XMLHttpRequest)

{

http=new XMLHttpRequest(); // code for IE7+, Firefox, Chrome, Opera, Safari

}

else if (window.ActiveXObject)

{

http=new ActiveXObject("Microsoft.XMLHTTP"); // code for IE6, IE5

}

else

{

alert("Seu browser não suporta autenticação xml. Favor autenticar no popup!");

}

http.open("GET", "/SitePages/Autenticacao.html", false, usuario, senha);

//http.setRequestHeader('Authorization', 'Basic');

http.onreadystatechange=function() {

if (http.readyState==4 && http.status==200) {

}

}

http.send(null);

if (http.status == 200) {

window.location = "http://www.google.com";

} else {

alert(msg);

}

return false;

}

Se alguém puder ajudar agradeço.

Edited by Carlos R JR
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...