uiwebviewdelegate

iOS - PDF Loaded in UIWebView then save to iBooks using UIDocumentInteractionController

六月ゝ 毕业季﹏ 提交于 2019-12-08 12:01:51
问题 I am loading a PDF from the web using a UIWebView, which works great and lets me interact with the PDF how I want. Next I would like to be able to save that PDF to iBooks, so I am using a UIDocumentInteractionController. In reading the docs it seems that you can only use UIDocumentInteractionController with local files rather than a remote file like I have. My question is, that PDF that UIWebView loads must be cached somewhere, so I really have to do another call to download that same file,

How to specify exactly the last time webViewDidFinishLoad for UIWebView get called?

☆樱花仙子☆ 提交于 2019-12-08 06:23:58
问题 I've read the previous post for this question, UIWebView - How to identify the “last” webViewDidFinishLoad message? but in fact I didn't get the answer very much. what I need is to execute a script on the webView but after it finishes its loading completely. I've tried to count the frames inside the HTML by reading it to a string and then counting them then loading the string I've read to the UIWebView, and counting the times webViewDidFinishLoad gets called but that's didn't work. so is

How to specify exactly the last time webViewDidFinishLoad for UIWebView get called?

跟風遠走 提交于 2019-12-08 02:17:28
I've read the previous post for this question, UIWebView - How to identify the “last” webViewDidFinishLoad message? but in fact I didn't get the answer very much. what I need is to execute a script on the webView but after it finishes its loading completely. I've tried to count the frames inside the HTML by reading it to a string and then counting them then loading the string I've read to the UIWebView, and counting the times webViewDidFinishLoad gets called but that's didn't work. so is there a way to accomplish that, or can any body tell me when webViewDidFinishLoad gets called exactly so I

Detecting and intercepting video playback in UIWebView

无人久伴 提交于 2019-12-07 10:54:27
问题 I would like to intercept a click in an UIWebView and then use the URL of the video. How is this possible? I found a somewhat similar post which pointed met to the webView:shouldStartLoadWithRequest:navigationType: delegate. I cant seem to get the loaded url of the video with this delegate. I am trying to get the code working in iOS8 回答1: There is a hacky way of finding the URL by listening for the AVPlayerItemBecameCurrentNotification notification. This notification is fired when a UIWebView

UIWebView and timeouts

十年热恋 提交于 2019-12-07 00:34:47
问题 I'm using a UIWebView to display some content. Within this content the user can navigate through a bunch of sites which are being loaded using AJAX. One step on this sites requires quite some time. Since I didn't find anything about a timeoue for UIWebView I tried to set it on the initial NSURLRequest it loads. Unfortunately this does not seem to do anything. I'm not quite sure if I'm supposed to set the timeout myself? Is there anything I'm missing? Does the UIWebView override my timeout? I

UIWebView content height not accurate in scrollview.contentsize

你离开我真会死。 提交于 2019-12-06 22:01:08
问题 I am trying to scroll to a particular page in a pdf document I have loaded in a UIWebView. I am able to do this without a problem in iOS 5 using: pageHeight = webView.scrollView.contentSize.height / numberOfPages; [[webView scrollView] setContentOffset:CGPointMake(0,pageNumber*pageHeight) animated:YES]; This only works however if the page has been loaded into the view already and the scroll to is triggered by a user action. For the case where I want to load a new pdf into the webview to a

UIWebView: Why does the request not time out when using a non-existant hostname?

痴心易碎 提交于 2019-12-06 10:11:07
My situation is this: I have a UIWebView which makes a POST request to a URL where the hostname is provided by the user. When the hostname does not exist, I need to timeout so that I can alert the user to say that they should check the their settings. What is happening: I make a request like this: NSString *theURL = [NSString stringWithFormat:@"https://%@%@", _hostname, LOGIN_PART_URL]; NSString *body = [NSString stringWithFormat:@"Username=%@&Password=%@", _username, _password]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL:[NSURL URLWithString:theURL] cachePolicy

UiWebView response to window.print

僤鯓⒐⒋嵵緔 提交于 2019-12-06 06:14:19
问题 Is there a way to detect window.print from a UIWebView and respond to it? I have printing in my UiWebView and need to have a way to react to that event from the UIWebView. 回答1: First, this is the solution I came across. But UIWebview does not support those events and the API like in a desktop browser. And haven't yet got the matchMedia to work. Probably will work when I have a printer configured!?!. The actual reason is that the media type of the web page did not change from screen to print

Detecting and intercepting video playback in UIWebView

 ̄綄美尐妖づ 提交于 2019-12-05 11:49:46
I would like to intercept a click in an UIWebView and then use the URL of the video. How is this possible? I found a somewhat similar post which pointed met to the webView:shouldStartLoadWithRequest:navigationType: delegate. I cant seem to get the loaded url of the video with this delegate. I am trying to get the code working in iOS8 There is a hacky way of finding the URL by listening for the AVPlayerItemBecameCurrentNotification notification. This notification is fired when a UIWebView shows the media player, and it sends an AVPlayerItem as the notification's object. For example: [

Detect and Customize UIWebView's “Unable to Read Document” error

梦想与她 提交于 2019-12-05 10:28:08
I'm testing a UIWebview with a number of different document types - .xlsx, .jpg, etc. - and it opens most of them just fine. From time to time, I open a local file and this message appears right in the web view: Unable to Read Document An error occurred while reading the document I'm not concerned with "why" this error occurs - it happens, for instance, when I feed the UIWebView a garbage file (intentionally). The problem is that I can't figure out how to detect "when" this happens. It doesn't trigger webView:didFailLoadWithError , it doesn't trigger an NSException (via @try & @catch ), and