• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [iPhone] Webview stringByEvaluatingJavaScriptFromString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [iPhone] Webview stringByEvaluatingJavaScriptFromString


  • Subject: Re: [iPhone] Webview stringByEvaluatingJavaScriptFromString
  • From: Development <email@hidden>
  • Date: Wed, 5 Aug 2009 14:50:51 -0700


The html is pretty straight forward. It is created with php and is as follows when you view source from the page:
<input type="hidden" name="encrypted" value="Success!".>


it is also within a form.

the UIWebView is built in IB and linked up. It loads correctly and the 'real' page passes it's variables along to the next correctly. The webview even posts the variable I need posted to it. Also when I test this code the webview is visible on screen.
below is the url loading code:


	NSURL * url = [NSURL URLWithString:@"http://mysite.com/test.php";];


NSString *myRequestString = [NSString stringWithFormat:@"appVersion= %i&userID=%@&password=%@",appVersion,passwordHolder];

NSData *myRequestData = [myRequestString dataUsingEncoding:NSUTF8StringEncoding];


NSMutableURLRequest *request = [ [ NSMutableURLRequest alloc ] initWithURL:url];
[ request setHTTPMethod: @"POST" ];
[ request setHTTPBody: myRequestData ];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];


webViewContainer.autoresizesSubviews = YES;
webViewContainer.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
webView.delegate = self;
webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);


	[webView loadRequest:request];
	

On Aug 5, 2009, at 2:33 PM, Fritz Anderson wrote:

NSString * aString =[theWebView stringByEvaluatingJavaScriptFromString :@"document.getElementsByName(\"encrypted\").value"];
NSLog(@"AString: %@",aString);

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >[iPhone] Webview stringByEvaluatingJavaScriptFromString (From: Development <email@hidden>)
 >Re: [iPhone] Webview stringByEvaluatingJavaScriptFromString (From: Fritz Anderson <email@hidden>)

  • Prev by Date: How do I change a UITableView's row-cell's color upon user selection?
  • Next by Date: Re: [iPhone] Webview stringByEvaluatingJavaScriptFromString
  • Previous by thread: Re: [iPhone] Webview stringByEvaluatingJavaScriptFromString
  • Next by thread: Re: [iPhone] Webview stringByEvaluatingJavaScriptFromString
  • Index(es):
    • Date
    • Thread