the AJAX login script

var xhr1 = new XMLHttpRequest();    
xhr1.open("post", '', false);

the problem is it gives me this error

Login Failure: Browser did not support Cookie. Please enable Cookie

and i can't send a cookie header cause it's a Forbidden header name ..... the page after i press login it sets the required cookies to perform a login . is there any way around this ?

some lines from the page source code that i think are important

var strCookie = document.cookie;

document.cookie = cookie;

var cookie = "Language=en" + expires + ";

var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

By default, XMLHttpRequest does not include cookies. Use withCredentials to send cookies along.

As an alternative, you can create a HTML form and submit that with JavaScript. This sends cookies along by default.

  • xhr.withCredentials didn't help ... "you can create a HTML form and submit that with JavaScript" you mean i copy the page form into a page and input the required data then trigger the submit function ? the page source code here is the login button code <a id="btnLogin" href="javascript:SubmitFormWithChallange(0);"> ... – MoooonX Jul 30 at 20:43
  • "This sends cookies along by default" i don't think so cause it sets the cookies into the browser sends it by it self in login cause it's the same domain ! and if it sets it in our page it won't help in any thing . " different domain " – MoooonX Jul 30 at 20:49

yes it is possible if only you could run the script on the same router page or with same url with some kind of local DNS rebinding to trick the browser that you are sending the request to the same site that the request is made from and both are the router page(address-ip) and redirecting only after you set the cookies manually ... or if some how you could sniff/get the after successful login cookies you would skip all this headache...check the both links for a better understanding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.