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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:27:16+00:00 2026-05-30T19:27:16+00:00

I have a UIViewController which contains a UIWebView . i login to a website

  • 0

I have a UIViewController which contains a UIWebView.

i login to a website for say facebook using the UIWebview in the UIViewController then i click on done, which dismiss the view controller, which i suppose will release the view controller. but when i open the UIWebview again (without exiting the app and also even after terminating the app) the webpage is still log into Facebook after the web view loads. How should i release the web view so that every time i click on done and return back to the web view, the web view will always be like “brand new” not log-on to any website that i had previously log-on to.

- (void)viewDidLoad{
       NSLog(@"webView viewDidLoad called");
       appDelegate = (LoginDBAppDelegate *)[[UIApplication sharedApplication] delegate];
       loginObj = [appDelegate.loginArray objectAtIndex:currentSelectedRow];

       myWebView.delegate = self;
        [super viewDidLoad];
        [self showWebView]; 

}

-(void)showWebView{
    NSLog(@"webView showWebView called");

    NSURL *url = [NSURL URLWithString:loginObj.loginURL];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];


    [myWebView loadRequest:request];
}


-(IBAction)done_Clicked:(id)sender{
    NSLog(@"webView Done_Clicked");

    //dismiss the controller
    [self.navigationController dismissModalViewControllerAnimated:YES];

}

-(void)dealloc{
        [myWebView release];
        myWebView.delegate = nil;
        [activity release];
        [urlTextField release];
        [super dealloc];
}

I have tried this but it didn’t work:

-(IBAction)done_Clicked:(id)sender{
NSLog(@"webView Done_Clicked");

[[NSURLCache sharedURLCache] removeAllCachedResponses]; 
[myWebView stringByEvaluatingJavaScriptFromString:@"var body=document.getElementsByTagName('body')[0];body.style.backgroundColor=(body.style.backgroundColor=='')?'white':'';"];
[myWebView stringByEvaluatingJavaScriptFromString:@"document.open();document.close()"];

//dismiss the controller
[self.navigationController dismissModalViewControllerAnimated:YES];

}

I have also tried this without any success:

- (void) viewDidDisappear:(BOOL)animated {

NSLog(@"webView viewDidDisappear called");
[super viewDidDisappear:animated];

[self.myWebView removeFromSuperview];
self.myWebView.delegate = nil;
self.myWebView = nil;
[myWebView release];
}
  • 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-30T19:27:17+00:00Added an answer on May 30, 2026 at 7:27 pm

    Got the answer from someone on the forum, so credit to him…

    Place this code in viewDidLoad

    //Set Cache
    NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
    [NSURLCache setSharedURLCache:sharedCache];
    
    //Clear All Cookies
    for(NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) {
    
        //if([[cookie domain] isEqualToString:someNSStringUrlDomain]) {
    
        [[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a root view controller which contains an outlet for my login view
I am using a view Controller which have contains tabbarcontroller(4 tabs). each tabbar have
I have a view controller which contains a UISearchBar @interface TradeFindHeaderViewController_iPhone : UIViewController {
I have written a subclass of UIViewController which creates a view programmatically, instead of
I have BaseView which implement UIViewController. Every view in project must implement this BaseView.
I have a NIB that contains a UINavigationController which has a UIViewController . The
I have a view controller which contains a scroll view. Inside the scroll view
I have a UIViewController which presents a modal view controller and when I rotate
I have a view which contains a tableview, (i call this view the EquationView,
I have a very simple scenario: My iPhone application contains a UIViewController implementation which

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.