uiwebview

Frame load interrupted error while loading a word document in UIWebView

混江龙づ霸主 提交于 2019-11-30 08:03:34
问题 I want to load a word document using UIWebView. I used the code provided in http://developer.apple.com/iphone/library/qa/qa2008/qa1630.html to load the document. But not all the documents load successfully. Sometimes I get an error Error Domain=WebKitErrorDomain Code=102 UserInfo=0x145bc10 "Frame load interrupted" The error seems to be very sporadic and I get this error only for some documents. However the same document loads correctly in mail.app. What am I missing? 回答1: The reason was, the

How to detect redirect in a UIWebView

时光怂恿深爱的人放手 提交于 2019-11-30 07:59:23
问题 I am using a UIWebView as an embedded browser within my app. The problem I have is tracking the URL that should be displayed in the URL bar. When doing a Google search, the results page often generates links like this: http://www.google.com/url?sa=t&source=web&cd=1&ved=0CC4QFjAA&url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDog&rct=j&q=dogs&ei=27XeTc6RFIWEvAO858DHBQ&usg=AFQjCNGkEDcWzea4pSlurHhcuQfqFcp_pw When the user clicks this link, the UIWebView first reports this link and then the

How to control page display to PDF loaded in UIWebView for iOS (go to page)

假装没事ソ 提交于 2019-11-30 07:49:43
I'm developing an app which displays a PDF embedded in a WebView this is my code: - (void)viewDidLoad { [super viewDidLoad]; NSURL *urlremoto = [NSURL URLWithString:@"https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/TransitionGuide.pdf"]; request = [NSURLRequest requestWithURL:urlremoto]; [self.webView loadRequest:request]; [self.webView setScalesPageToFit:YES]; } -(void)webViewDidStartLoad:(UIWebView *)webView{ [self.activityIndicator startAnimating]; } -(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{ //TODO: describir

UIWebView with just an image that should fit the whole view

回眸只為那壹抹淺笑 提交于 2019-11-30 07:45:20
So the issue I'm having now is with UIWebViews displaying a single image. What I'd like is the image to be reduced if it doesn't fit the place, and keep it's original size if not. So here is how I do it (in a UIViewController): - (void)viewDidLoad { [super viewDidLoad]; UIWebView *webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 80)]; NSString *path =[[NSBundle mainBundle] bundlePath]; NSURL *baseUrl =[NSURL fileURLWithPath:path]; NSString *html = [NSString stringWithFormat:@"<html><head>" //THE LINE ABOVE IS TO PREVENT THE VIEW TO BE SCROLLABLE "<script

Detecting Download in UIWebView

橙三吉。 提交于 2019-11-30 07:42:36
问题 I have a programatically crated UIWebView , and it is used to browse a iPhone-style site stored on my server. In this website, there are a few links to files users can download into my application. Right now, I'm trying to detect this with: - (BOOL) webView:(UIWebView *) webView shouldStartLoadWithRequest:(NSURLRequest *) request navigationType:(UIWebViewNavigationType) navigationType { url = [request URL]; NSString *mimeType = [request valueForHTTPHeaderField:@"Content-Type"]; NSLog(@

How to preselect contenteditable field in UIWebView iOS5

て烟熏妆下的殇ゞ 提交于 2019-11-30 07:38:23
问题 First of all I know contenteditable is only iOS 5 I have accounted for this - we are giving users with iOS 5 a feature to allow Rich Text pasting using contenteditable. This feature works great so far all I want to do is when the view appears to set the contenteditable field as active (pre-select it) so that the keyboard appears and the user can begin typing right-away. Here is the local html file I am using for the UIWebView <html> <body> <div id="content" contenteditable="true" style="font

change content of uiwebview div object

徘徊边缘 提交于 2019-11-30 07:37:39
is there any way to change the content of uiwebview in iphone application? by using div or else. my problem is that, to append data to uiwebview at any time. it think it can be done by replacing div content? Satya You can change like this [webview stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementById('divtagId').innerHTML ='%@';",newContent]]; 来源: https://stackoverflow.com/questions/4459488/change-content-of-uiwebview-div-object

PreLoad UIWebView on a not yet displayed UIViewController

坚强是说给别人听的谎言 提交于 2019-11-30 07:30:54
I have an app where on the very last UIViewController there is a UIWebView... the user navigates through the app and at the very end they can transition (modal) to the final UIViewController with a UIWebView... in it's viewDidLoad I have the UIWebView load the page. The problem is it takes about 8 seconds to load this page and that annoys users. How can I load the UIWebView way ahead of time (like when the app is first launched!) if that UIViewController hasn't even been presented yet? I had your same problem for UIWebView inside a UIPageViewController and I found a better solution. If you are

Access the JavaScriptCore engine of a UIWebView

主宰稳场 提交于 2019-11-30 07:27:15
I just discovered a new framework available in iOS7: JavaScriptCore. It looks awesome, but how can I access the runtime/context of a UIWebView ? TomSwift There is no official mechanism for this. But there are two approaches I know about to get the JSContext . I probably wouldn't use either in a shipping app. Use KVC to access internal UIWebView properties. Explained in detail in this blog post: http://blog.impathic.com/post/64171814244/true-javascript-uiwebview-integration-in-ios7 JSContext *ctx = [webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"]; Add a magic method

Allow UIWebView to load http://localhost:port/path URIs without an Internet connection

我只是一个虾纸丫 提交于 2019-11-30 07:20:01
I am working on an iPad app which has an embedded HTTP server listening on a high port, and I am loading pages from this HTTP server using a UIWebView . For the functionality of the app, it is important that this works when no network connection is available. The UIWebView is loading URLs of the form http://localhost:port/path When I disable Wi-Fi on my iPad and run the application, the UIWebView ’s delegate gets a webView:didFailLoadWithError: message with the following NSError object: Error Domain=NSURLErrorDomain Code=-1009 UserInfo=0x1b4a50 "no Internet connection" Clearly the SDK is being