uiwebview

iOS Open Document with External App from UIWebVIew

无人久伴 提交于 2019-12-04 13:00:06
I have a UIWebView . When a link which contains a document is clicked, I want to open that document in a external app (office, openoffice, etc) but not inside the UIWebView . I know how to do it for emails: - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { if ([[[request URL] scheme] isEqual:@"mailto"]) { [[UIApplication sharedApplication] openURL:[request URL]]; return NO; } return YES; } Is there any way to do this but for documents? Thanks! EDIT: That's what I have done: - (BOOL)webView:(UIWebView

How to change keyboard button “Return” to “Search” for input in a UIWebView?

浪子不回头ぞ 提交于 2019-12-04 12:59:58
I have this simple HTML file that is to be displayed in a UIWebView. <html> <body> <p> <input name='search' type='search' placeholder="Input type is search" /> </body> </html> Here is the screenshot when I clicked the input box. How to change the Return button to 'Search' like Google page does? I found a simple solution. Just wrap the input with form tag so the HTML looks like this. <html> <body> <p> <form> <input name='search' type='search' placeholder="Input type is search" /> </form> </body> </html> And now the keyboard looks like dcorbatta Looking in the reference: Text Programming Guide

How to save dynamic webpage in cache using UIWebview in Swift 3

怎甘沉沦 提交于 2019-12-04 12:41:45
I am developing an application(Swift 3 using UIWebview). I need to load webpages into webview and save some webpages into cache. If there is not internet user will able to see those pages. But I am confused on how to save whole webpage in cache. The main thing is we need to show pages back even if there is not internet. I used the following documention : http://nshipster.com/nsurlcache/ and https://developer.apple.com/reference/foundation/urlcache let url = NSURL(string: load_url1) let request = NSURLRequest(url: url as! URL,cachePolicy: NSURLRequest.CachePolicy.returnCacheDataElseLoad,

Downloading files from uiwebview in iphone sdk

僤鯓⒐⒋嵵緔 提交于 2019-12-04 12:37:17
问题 Is there any way to download file from UIWebView i am using this code on my IBAction event - (IBAction)saveFile:(id)sender { // Get the URL of the loaded ressource NSURL *theRessourcesURL = [[self.webDisplay request] URL]; NSString *fileExtension = [theRessourcesURL pathExtension]; if ([fileExtension isEqualToString:@"png"] || [fileExtension isEqualToString:@"jpg"] || [fileExtension isEqualToString:@"pdf"] || [fileExtension isEqualToString:@"html"]) { // Get the filename of the loaded

iPhone dev: Increase scroll speed in UIWebView?

眉间皱痕 提交于 2019-12-04 12:35:40
问题 I have an app in which I render local HTML files in a UIWebView. The files, however, are sometimes large, and getting to where you want takes a long time with the default scroll speed. Is there any way to boost up the vertical scroll speed of a UIWebView? 回答1: In iOS 5 we can access the scrollView property of the UIWebView . If you are targeting iOS 5+, you can simply call: webView.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal; 回答2: Find a subview of UIWebView which is a

How to load local html assets in directories (js, images, css) in a UIWebview? (iOS)

馋奶兔 提交于 2019-12-04 12:26:22
Specifically -- how do you get all the assets to load from their respective directories (images/, css/, js/) without changing the content of the original HTML (removing directories)? I am using this code to load index.html into the UIWebview: NSURL *url = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html"]; NSString *html = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil]; NSString *path = [[NSBundle mainBundle] bundlePath]; NSURL *baseURL = [NSURL fileURLWithPath:path]; [webView loadHTMLString:html baseURL:baseURL]; Then my html looks like this:

UIWebView stringByEvaluatingJavaScriptFromString in background

假装没事ソ 提交于 2019-12-04 12:23:55
问题 In an iOS app, I'm running a fairly large script on a UIWebView using stringByEvaluatingJavaScriptFromString (large in terms of the length of the javascript string). There is a brief pause after calling the javascript causing other elements on the screen to hiccup for a moment. Placing the javascript call in a function called in the background with self performSelectorInBackground breaks the application. Is there a safe way to call run this on a background thread or otherwise prevent the

UIWebView won't scroll till the end / bottom

安稳与你 提交于 2019-12-04 12:15:53
问题 I have the same problem as described here: UIWebView doesn't scroll to the bottom of the webpage loaded/created (unfortunately nobody answered there) I have a UIWebView with inside UIView, and it doesn't scroll to the bottom, it's actually possible to scroll it but it is bouncing back again, so I can't see about bottom 100 px of my WebView, what can it be? Thank you 回答1: Sorry guys, was my fault, I just had to reduce the height of the WebView 回答2: I got this problem today. I had set the

Playing youtube using <iframe> fails on iPhone, but still works for iPad under iOS 6 (both work fine on iOS 5)

♀尐吖头ヾ 提交于 2019-12-04 12:02:42
I use the following HTML template with an to hand to a UIWebView. I understand that this is the supported way to play youtube videos. <html> <body> <!-- 1. The <iframe> (and video player) will replace this <div> tag. --> <div id="player"></div> <script> // 2. This code loads the IFrame Player API code asynchronously. var tag = document.createElement('script'); tag.src = "http://www.youtube.com/player_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); // 3. This function creates an <iframe> (and YouTube player) //

Detect video start playing in WKWebView

六月ゝ 毕业季﹏ 提交于 2019-12-04 11:54:17
I'm using WKWebView for loading an youtube page. I need to detect the video starts playing in the webview in inline mode and in the full screen mode. I tried MPMoviePlayerController Notifiers but they are not calling. But the same is working in UIWebView. So my question is, Is there any difference in the video playing mechanism used in UIWebView and WKWebView ? Why MPMoviePlayerController Notifiers are not calling in WKWebView ? Is there any method to detect the video play in WKWebView ? Or is there any method to detect whether the user has tapped the video play button ? 来源: https:/