0

Hey guys I have a simple html NSString, it works fine on the browser but does not load on the iPhone. I am using a simple: [self.w loadHTMLString:errorString baseURL:nil]. What am I missing?

NSString* errorString = [NSString stringWithFormat:
        @"<html><body> <iframe src=\"http://64.183.101.142:81/pda.htm\"width=\"500\" height=\"500\"></iframe></body></html>"];
Adam Richardson
  • 2,518
  • 1
  • 27
  • 31
stack_Ptr
  • 23
  • 1
  • 8

2 Answers2

0

Yo need to first load your request or HTML on webview and Capture this request using a UIWebViewDelegate method with following protocol

 - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
    {

      //capture request =>  request
       //From here you have the NSURLRequest object
  //You can extract the headers of the request to NSDictionary which will contain   //the         
//authentication cookie details, token, etc. using the following method of NSURLRequest
        //- (NSDictionary *)allHTTPHeaderFields

    }

Source Source link

Community
  • 1
  • 1
Satish Azad
  • 2,302
  • 1
  • 16
  • 35
0

If it requires authentication you will need to modify your string depending on the type of request.

if it's a get it will have a "?" at the and the parameters something like this: http://xx.xx.xx.xx:81/pda.htm?user="userX"&passwd="something" if it's a post method you will pass your data within the body of your request. [NSURLRequest setHTTPBody:];

I hope this helps.

artud2000
  • 544
  • 4
  • 9