Note that there are some explanatory texts on larger screens.

plurals
  1. POUIWebView load desktop version of website not Mobile version
    primarykey
    data
    text
    <p>There is a button on ViewController A, that when pressed should take me to ViewControllerB which has a UIWebView. That web view should load the desktop version of a website.</p> <p>These are the steps I take:</p> <ol> <li><p>ViewController A - Touch button </p></li> <li><p>ViewController B - The UIWebView loads the mobile version of the website instead of desktop version.</p></li> <li><p>NavigationController - Touch the back button -> takes us back to ViewController A </p></li> <li><p>ViewController A - Touch the button again</p></li> <li><p>ViewController B - UIWebView loads the desktop version as desired.</p></li> </ol> <p>The first time (Step 2), the UIWebView does not load the correct URL and second time (Step 5) it loads the correct URL.</p> <p>VIEW A-</p> <pre><code>-(IBAction)ButtonPressed:(id)sender{ HomeAppDelegate *myDelegate = (HomeAppDelegate *)[[UIApplication sharedApplication]delegate]; NSString *titleCaption;WebPageViewController *chosenViewController = [[WebPageViewController alloc] initWithNibName:@"WebPageViewController" bundle:nil]; titleCaption = @"Web PAGE"; chosenViewController.url = [NSURL URLWithString:@"http://www.mydesktopwebsite.com"]; [self.navigationController pushViewController:chosenViewController animated:YES]; myDelegate.navBar.topItem.title = titleCaption; [chosenViewController release]; } </code></pre> <p>VIEW B - WebPageViewController.h</p> <pre><code>@property (retain, nonatomic) IBOutlet UIWebView *WebView; @property (retain, nonatomic) NSURL *url; </code></pre> <p>WebPageViewController.m</p> <pre><code>@synthesize url; - (void)viewDidLoad{ [super viewDidLoad]; [self.WebView loadRequest:[NSURLRequest requestWithURL:self.url]];} </code></pre> <p>(Edit note from jcesar: You edited my answer, but I think you wanted to edit your question, so I add the code you put in my answer)</p> <blockquote> <p>I was using following code which obviously wrong.</p> </blockquote> <pre><code>NSDictionary *dictionary = @{ @"UserAgent" : @"Safari iOS 5.1 - iPhone"}; [[NSUserDefaults standardUserDefaults] registerDefaults:dictionary]; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload