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 6215861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:07:58+00:00 2026-05-24T07:07:58+00:00

i am developing an app using phonegap for mobile platforms. For that im using

  • 0

i am developing an app using phonegap for mobile platforms. For that im using js and so need to do many ajax calls. What i need to do is add a cookie (or modify its value if its already present) in the request header of an XMLHttpRequest.
I know it says here that its not possible – How do I SET a Cookie (header) with XMLHttpRequest in JavaScript?
But one seems to be able to modify the value of the ‘Cookie’ field in request headers, before making the xhr call, as its given in the answer here: http://developer.appcelerator.com/question/120728/set-cookies-using-setrequestheader–crashed-

It says that we can set the ‘Cookie’ field of the xhr req header for android and iphone in different ways like this:

if (Titanium.Platform.name == 'iPhone OS')  
{
xhr.setRequestHeader("Cookie", "cookie1=value1");
xhr.setRequestHeader("Cookie", "cookie2=value2");
}
else
{
var cookieString = "cookie1=value1; cookie2=value2;";
xhr.setRequestHeader('Cookie', cookieString);
}

but im just using js, i cant use methods/classes for iphone/android.
what i need to know is, if the browser sends a ‘Cookie’ header something like

xyz_cookie=vd0dKmD4mT; qwe=13aef60f7d0845
can i add another cookie "abc=1317331740;" by using the xhr.setRequestHeader method in a way that the browser sends all 3 cookies

xyz_cookie=vd0dKmD4mT; qwe=13aef60f7d0845 abc=1317331740;

in the cookie field in the request header of xhr?
If yes, pls tell me how?

  • 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-24T07:08:00+00:00Added an answer on May 24, 2026 at 7:08 am

    xhr.setRequestHeader cant be used to set Cookie according to w3c recommendations.
    i guess thats why it was failing. 🙁
    Also that cookies dont work on phonegap android apps. so that was adding to the document.cookie confusion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an app using phonegap for Android. I want this mobile application
I'm developing an app using jquery mobile, phonegap and openDatabase. When the app is
I am developing an app using jqm+phonegap. In my app, user need to set
I'm developing a web app using Django, and I'll need to add search functionality
I am developing a Android app using Jquery Mobile/Phonegap. I have the following code
I am developing an iphone app on phonegap and I am using jQuery mobile.
I am developing a web app (using rails) that I will be launching within
I am developing a iPhone app using Monotouch. I need to access a Sqlite
I am developing an app using android OS for which I need to know
I am developing a WPF app using MVVM and need some help. for the

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.