Detect if page is loaded inside WKWebView in JavaScript

The accepted answer doesn’t work as tested using the WKWebView vs UIWebView app As the article mentions, the only HTML5 feature difference is IndexedDB support. So I’d go for a more reliable pattern with: if (navigator.platform.substr(0,2) === ‘iP’){ //iOS (iPhone, iPod or iPad) var lte9 = /constructor/i.test(window.HTMLElement); var nav = window.navigator, ua = nav.userAgent, idb … Read more

How to download PDF and store it locally on iPhone?

I have found one method which I tried myself: // Get the PDF Data from the url in a NSData Object NSData *pdfData = [[NSData alloc] initWithContentsOfURL:[ NSURL URLWithString:@”http://www.example.com/info.pdf”]]; // Store the Data locally as PDF File NSString *resourceDocPath = [[NSString alloc] initWithString:[ [[[NSBundle mainBundle] resourcePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@”Documents” ]]; NSString *filePath = [resourceDocPath stringByAppendingPathComponent:@”myPDF.pdf”]; [pdfData … Read more

Allow unverified ssl certificate in UIWebview

If it’s just for testing during development you can create a category on NSURLRequest and override the following private method: #if DEBUG @implementation NSURLRequest (NSURLRequestWithIgnoreSSL) + (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host { return YES; } @end #endif Just put this anywhere in one of your .m files (e.g. app delegate), or put it in it’s own .m file. … Read more

Remove UIWebView Shadow?

This is a cleaner alternative to “Nikolai Krill” solution. This only hides UIImageViews within the UIWebView and not the UIWebBrowserView. for (UIView *view in [[[webView subviews] objectAtIndex:0] subviews]) { if ([view isKindOfClass:[UIImageView class]]) view.hidden = YES; } Thanks James

ITMS-90809: Deprecated API Usage – existing app that use UIWebView are no longer accepted

Yes, Apple did change the policies Are you using ionic? if so, install these: cordova plugin add cordova-plugin-ionic-webview@latest npm install @ionic-native/ionic-webview Then add this to your config.xml under ios platform: <preference name=”WKWebViewOnly” value=”true” /> <feature name=”CDVWKWebViewEngine”>` <param name=”ios-package” value=”CDVWKWebViewEngine” /> </feature> <preference name=”CordovaWebViewEngine” value=”CDVWKWebViewEngine” /> Finally run ionic cordova prepare ios to reflect the changes … Read more

Go vs. return button in iOS keyboard for HTML input forms

Update 2020/2021 As Cameron Cobb pointed out, Safari Mobile supports the new HTML attribute enterkeyhint since version 13.7 ~ Sept. 2020 (https://caniuse.com/mdn-html_global_attributes_enterkeyhint). The following values are possible (https://mixable.blog/ux-improvements-enterkeyhint-to-define-action-label-for-the-keyboard-of-mobile-devices/): <input enterkeyhint=”enter”> <input enterkeyhint=”done”> <input enterkeyhint=”go”> <input enterkeyhint=”next”> <input enterkeyhint=”previous”> <input enterkeyhint=”search”> <input enterkeyhint=”send”> Original Answer Aha… The ‘Go’ button is only shown, if the <input> tag … Read more

Loading a webpage through UIWebView with POST parameters

Create POST URLRequest and use it to fill webView NSURL *url = [NSURL URLWithString: @”http://your_url.com”]; NSString *body = [NSString stringWithFormat: @”arg1=%@&arg2=%@”, @”val1″,@”val2″]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL: url]; [request setHTTPMethod: @”POST”]; [request setHTTPBody: [body dataUsingEncoding: NSUTF8StringEncoding]]; [webView loadRequest: request];