Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6903017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:52:20+00:00 2026-05-27T07:52:20+00:00

I am not too much of a web developer so this might be a

  • 0

I am not too much of a web developer so this might be a newbie question.

I am trying to do xml request where I send a user name and password. On the reply my server application will stick a cookie in the response header. Will this cookie be accessible using the document.cookie variable?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:52:21+00:00Added an answer on May 27, 2026 at 7:52 am

    Yep, you definitely can. I made a program to test it.

    HTML file:

    <!DOCTYPE html>
    <html>
    <head>
    <style>
    div {
        position:relative;
        left:10px;
        top:10px;
        width:100px;
        height:70px;
        background-color:#F00;
    }
    </style>
    </head>
    <body>
    <div onclick="sendRequest('cookieset.php')">Click me</div>
    </body>
    <script>
    function sendRequest(address) {
        var xmlRequest = (window.XMLHttpRequest)?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");
        if(xmlRequest == null) {
            console.log("Error: XMLHttpRequest failed to initiate.");
        }
    
        xmlRequest.onreadystatechange = function() {
            if (xmlRequest.readyState == 4) {   //Completed loading
                if (xmlRequest.status == 200 || xmlRequest.status == 0) {
                    alert(document.cookie)
                }
                else    //Otherwise, there was a problem while loading
                    xmlContainer.innerHTML = "Error " + xmlRequest.status + " has occurred.";
            }
        }
        try {
            xmlRequest.open("GET", address, true);
            xmlRequest.send(null);
    
        } catch(e) {
            console.log("Error retrieving data file. Some browsers only accept cross-domain request with HTTP.");
        }
    
    }
    </script>
    
    </html>
    

    PHP file:

    <?php 
        setcookie("cookieTest", "good", 0); 
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not into bits and bytes too much, so my apologies if this question
Not too sure how to formulate my question and I hope that this is
I'm not too good with SQL and I know there's probably a much more
Not too sure what's going on here as this doesn't seem like standard practise
Not too sure if I'm doing this right. It looks a bit more convoluted
I'm not too sure what's going on here but I'm trying to echo a
I'm not too great with jquery and maybe this title doesn't explain too well
Im a newish Ruby/Rails developer with years of Java experience. This security question is
I remember the days (not too long ago, really) when log4net came along with
I am not too clear about the autorelease message... When autorelease is sent to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.