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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:13:16+00:00 2026-06-14T18:13:16+00:00

This is really annoying me. I have a webView, and I am trying to

  • 0

This is really annoying me. I have a webView, and I am trying to get it too load drive.google.com. However, because of the amount of redirects on that site, the webView does nothing. I know that the code for loading a webView works, and that URL is correct, as I get the didFailWithProvisionalLoadWithError message. That is how I know that it is the redirect problem.

I have looked all over, but can find no way to alter the amount of allowed redirects. I know that it is possible, as Safari can handle it. There has to be some kind of delegate method to override. No code today, as all my searches (4 days worth of them) have lead me to nothing.

If anyone has an idea, let me know. FYI, this is Cocoa (WebView) not cocoa touch (UIWebView). Thanks.

  • 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-14T18:13:17+00:00Added an answer on June 14, 2026 at 6:13 pm

    That for which you have been searching is

    – webView:decidePolicyForNavigationAction:request:frame:decisionListener:

    which is part of the WebPolicyDelegate protocol.

    Read the documentation for WebPolicyDelegate, particularly the discussion for this delegate method. The documentation for WebPolicyDecisionListener describes the messages you can send to the listener. You might identify a redirect inside this delegate method, and you could instruct the decision listener to use or ignore it.

    EDIT:

    I appreciate the 50 points, but if I didn’t help you solve your problem, I hardly think I deserve them, and that was enough guilt to motivate me to sit down and try out your problem.

    I built a tiny app, one that isn’t document based, or uses ARC or garbage collection. I turned off Auto Layout in the MainMenu.xib file, and simply placed an instance of WebView inside it. I modified AppDelegate to include an outlet for the WebView instance.

    I then created fleshed out the -applicationDidFinishLaunching: stub like this:

    - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
    {
        NSString *urlString = @"http://drive.google.com";
        NSURL *url = [NSURL URLWithString:urlString];
        NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
    
        [[[self webView] mainFrame] loadRequest:urlRequest];
    }
    

    and if I’m getting redirects, they don’t seem to be affecting my ability to display the page.

    Are we on the same page (no pun intended)?

    EDIT 2:

    Good news (or bad news, depending on your POV): Redirects were never the problem (though they did help to shed light on what was really going on).

    When it comes to Google Drive, WebView isn’t an approved browser. You can, however, fix that (N.B., below) by modifying the user agent string. Here’s the revised code:

    - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
    {
        NSString *urlString = @"http://drive.google.com";
        NSURL *url = [NSURL URLWithString:urlString];
    
        NSString *customUserAgent = [NSString stringWithFormat:@"%@ Version/6.0.2 Safari/8536.26.17", [[self webView] userAgentForURL:url]];
    
        [[self webView] setCustomUserAgent:customUserAgent];
    
        NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
    
        [[[self webView] mainFrame] loadRequest:urlRequest];
    }
    

    N.B.: The user interface appears to be fully functional, but even so, Google may change its means of determining what the browser is and break this scheme, so consider yourself warned. You might want to explore their SDK for possible alternate means of accessing Google Drive.

    As always, good luck to you in your endeavors.

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

Sidebar

Related Questions

I come to you because I have this really annoying issue. In Xcode, I
This is really annoying me as I have done it before, about a year
Xcode states. xxxx@gmail.com is not a Registered Apple Developer. This is really annoying, as
Ok this is a really annoying bug that I have been having issues with
The code below is really annoying me I have looked on stackoverflow and google
OK, this is really annoying. I have the (almost) simplest class possible. Two files:
This is getting really annoying for me. I only have this line for my
This is really annoying me. In Objective-C, I have an Item entity with a
I've been having this really annoying thing happen the past few days, that has
I am having this really annoying problem on a php-site I am programming and

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.