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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:09:23+00:00 2026-06-03T05:09:23+00:00

I have an iOS app where I am loading html content inside a webview.

  • 0

I have an iOS app where I am loading html content inside a webview. The html is a login page wherein the user credentials are sent to the server via ajax and an authentication success/failure response is received. Now, the response contains a cookie (in the Set-Cookie header field) which I can capture on the Objective-C side like so,

NSDictionary* headers = [(NSHTTPURLResponse *)response allHeaderFields]; 
NSString *strCookies = [headers valueForKey:@"Set-Cookie"]; 
NSLog(@"cookies -> %@", strCookies);

The same response also contains a responseText which I use inside the browser:

Ajax("/login", "POST", { onsuccess : function(response){ 
       /* Do HTML stuff with response */ }  
});

Now I need the cookie to make further ajax requests (after the login page). However, the cookie is not set inside the webview browser. Looking for document.cookie returns an empty string. I can print all the response headers using xhr.getAllResponseHeaders() but I cannot access the Set-Cookie field in the xhr object.

How can the cookie be set inside the webview? Or I have no choice but to make all ajax requests via Obj-C?

  • 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-06-03T05:09:25+00:00Added an answer on June 3, 2026 at 5:09 am

    You can set the cookie in the request that you send to the webview.

    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:yourURL];
    [request setValue:yourCookie forHTTPHeaderField:@"Cookie"];
    

    This could be done in the UIWebview delegate shouldStartLoadWithRequest

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

Sidebar

Related Questions

I have created an iOS app that requires a user to link his/her Dropbox
I have a loading screen for my app (default.png). When user suspends my app,
I have a very simple iOS app with a uiwebview loading a very simple
I have an iOS app I created as a view-based app in xCode. I
I have an iOS app and I want to make it accessible. Everything goes
I have a Rails app that has 2 clients -- an iOS app reads/writes
In our iOS app, we have subclassed a UISlider in order to use a
Assume I have a Cocoa-based Mac or iOS app. I'd like to run a
I'm building an iOS app and I have all the functionality going already so
1)I am creating a ios app in which I have to scan a pool

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.