Re: [iPhone] Webview stringByEvaluatingJavaScriptFromString
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