Can I prevent phone from sleep on a webpage

You can use: https://github.com/richtr/NoSleep.js Prevent display sleep and enable wake lock in any Android or iOS web browser. Note that the library has some reliability/performance issues on some platforms/browsers. Users have found solutions that are listed in the issue comments and pull requests, but they have not been added since the repo owner appears not … Read more

how to intercept Button click inside UIWebview on IOS?

You can do the following: In your HTML <a class=”yourButton” href=”https://stackoverflow.com/questions/10992339/inapp://capture”>Button Text</a> In your UIWebViewDelegate – (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { if ([request.URL.scheme isEqualToString:@”inapp”]) { if ([request.URL.host isEqualToString:@”capture”]) { // do capture action } return NO; } return YES; } I added “capture” to your button’s URL so that you could distinguish between several … Read more

iOS: How can i receive HTTP 401 instead of -1012 NSURLErrorUserCancelledAuthentication

Yes. Stop using the synchronous API. If you use the asynchronous delegate-based API then you have a lot more control over the connection. With this API, except in cases where an error is encountered before the HTTP header is received, you will always receive -connection:didReceiveResponse:, which gives you access to the HTTP header fields (encapsulated … Read more

Problem using NSURLRequest to POST data to server

You should remove the leading & in myRequestString and the problem is likely that the correct content-type header is not being sent. Try adding a call to [request setValue:@”application/x-www-form-urlencoded” forHTTPHeaderField:@”content-type”]; You should also not pass nil for error, so you can see what the client thinks is going on. Unrelated, but your PHP code is … Read more

iPhone: NSHTTPCookie is not saved across app restarts

You can save the cookie by saving its properties dictionary and then restoring as a new cookiebefore you go to re-connect. Save: NSArray* allCookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[NSURL URLWithString:URL]]; for (NSHTTPCookie *cookie in allCookies) { if ([cookie.name isEqualToString:MY_COOKIE]) { NSMutableDictionary* cookieDictionary = [NSMutableDictionary dictionaryWithDictionary:[[NSUserDefaults standardUserDefaults] dictionaryForKey:PREF_KEY]]; [cookieDictionary setValue:cookie.properties forKey:URL]; [[NSUserDefaults standardUserDefaults] setObject:cookieDictionary forKey:PREF_KEY]; } } … Read more

Adding Images to UIActionSheet buttons as in UIDocumentInteractionController

There is a possibility to add images (to be exact: icons or symbols) to the buttons of a UIActionSheet (or a UIAlertView) without loading image files or fiddling around with (sub)views. In these classes buttons are specified by their titles, which are strings. So it is obvious to use symbols, which one can specify also … Read more

Is it possible for a UIWebView to save and autofill previously entered form values (e.g., username & password)?

From my looking I don’t think there is an easy way to do it. Here is an idea of what might work though: create your uiwebview create a nsurlrequest after your webview delegate page loaded function fires look in the request’s http body find the form for login (regex for common login forms?) retrieve give … Read more