uiwebview

Open .msg and .eml files from iOS UIWebview

守給你的承諾、 提交于 2019-12-04 19:43:48
I am trying to display .msg and .eml files using iOS sdk 5.1 in a UIWebView. I have the files in a binary format (NSData). I am able to display doc, docx, ppt, pptx, xls, xlsx, pdf, png, bmp and jpg files in the UIWebView but not the .msg and .eml files. Are msg and eml files supported by UIWebView? If not, is there some other way to display such files? They open fine from the Mail app. I am getting the following error from webView:didFailLoadWithError: 2012-08-09 15:59:03.851 HelloWorld[5848:707] Error loading attachment Error Domain=WebKitErrorDomain Code=102 "Frame load interrupted"

UIScrollView + UIWebView = NO scrollsToTop

泄露秘密 提交于 2019-12-04 19:37:24
问题 It looks like a problem which could have simple solution, but I haven't found anything what could lead the way to it. I'm using UIWebView inside of UIScrollView and tapping on statusBar (to scroll content to top) is not working. I've made simple test application to see if it's really UIWebViews fault. And it really is. // scrolls to top on status bar tap UIScrollView *sv = [[UIScrollView alloc] init]; sv.frame = CGRectMake(0, 0, 320, 480); sv.contentSize = CGSizeMake(320, 1200); [self.view

How do I include CSS resource in programmatically generated HTML for iPhone UIWebView?

浪尽此生 提交于 2019-12-04 19:35:17
I am programmatically generating HTML and want to link to a CSS file that I've included in my Resources folder. I am using a baseURL of nil, and my CSS file is at the top level of the project file, but this "link" is definitely not working (ie, the CSS file is clearly not being loaded/found when the UIWebView displays the HTML). Is it possible to do this? Or will I need to put the CSS file on the web somewhere and link to it via a URL? (I can see the advantage of doing this -allowing the app to change its style without redistributing the app). Thanks Thanks everyone! Here's what I did, works

load local image into UIWebView

依然范特西╮ 提交于 2019-12-04 19:12:16
I want to take a screenshot and then send to webview a local path for it, so it will show it. I know that webview could take images from NSBundle but this screenshots are created dynamically - can I add something to it by code? I was trying it like this: UIGraphicsBeginImageContext( webView.bounds.size); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); NSString *file = @"myfile.png"; NSString *directory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES)

Android's addJavascriptInterface equivalent in iOS

邮差的信 提交于 2019-12-04 18:42:55
问题 As you may know, Android's WebView has a method named addJavascriptInterface() which imports an Android JAVA object to Javascript context. the question is, Is there any equivalent of it on iOS? 回答1: UIWebView on iOS doesn't have methods to add interface to DOM. But you still can talk to your code from javascript assigning something to window.location and handling that request in webView:shouldStartLoadWithRequest:navigationType: delegate method. 回答2: I know this question is really old, but it

jQuery Mobile is NOT triggering webViewDidStartLoad and webViewDidFinishLoad after leaving homepage in webView

☆樱花仙子☆ 提交于 2019-12-04 18:22:25
I have a simple iOS app with a single view that contains a UIWebView. Within my webView, I display my jQuery Mobile website. Since jQuery Mobile loads pages via ajax, the webViewDidStartLoad and webViewDidFinishLoad methods are NOT called once the initial page loads. I've found similar questions on SO such as this one , but I'm not sure where to use the window.location = "localFunction" call, and no one has yet to confirm this actually works. Here's my issue (example): App Starts shouldStartLoadWithRequest is called webViewDidStartLoad is called, and network activity indicator is shown.

iPhone: Performances Differences Between NSURLRequestCachePolicy Settings

二次信任 提交于 2019-12-04 18:09:43
问题 When using NSURLRequest on the iPhone, what are the real world performance differences between the various NSURLRequestCachePolicy settings? I am specifically interested in the cache policy's effect on the the user's perception of the speed at which UIWebView pages display. I have been using the default NSURLRequestCachePolicy but I think that perhaps NSURLRequestReloadRevalidatingCacheData could be best for most cases especially when going back to a previous page. If you've used various

WKWebKit: No dataDetectorTypes parameter

◇◆丶佛笑我妖孽 提交于 2019-12-04 17:57:46
问题 In UIWebView , it was fairly easy to add UIDataDetectorTypes to a view: myUIWebView.dataDetectorTypes = UIDataDetectorTypePhoneNumber; And so on. However, WKWebView does not seem to have a similar property. This reference mentions that it has moved to the WKWebViewConfiguration property at myWebKitView.configuration , but both the official documentation and the headers themselves make no reference to dataDetectorTypes . I'm currently trying to migrate an app from using UIWebView to WKWebView

Disabling data detectors for a specific HTML element in a UIWebView

北城余情 提交于 2019-12-04 17:56:17
问题 Does anyone know if it's possible to disable the data detectors for phone numbers, email addresses etc in a UIWebView, for specific HTML elements only? I'd like the detectors to be active for most of the content loaded into the UIWebView, but disable it in certain areas. If this is possible, I'm assuming it would be achieved by using an HTML attribute in the loaded content (rather than setting some sort of UIWebView property), e.g. <html> <body> <h1 datadetectors="off">Header text with number

Display PDF in UIWebView using loadData

半城伤御伤魂 提交于 2019-12-04 17:48:05
问题 I am trying to display a PDF I have stored locally in a UIWebView. This is how I currently attempt to do this: if (![[NSFileManager defaultManager] fileExistsAtPath:self.url]) { LOG_ERROR(@"Couldn't load local file. File at path: %@ doesn't exist", self.url); return; } nsurl=[NSURL fileURLWithPath:self.url]; NSData *data = [NSData dataWithContentsOfFile:self.url]; LOG_DEBUG(@"data length:%d",[data length]); [self.webView loadData:data MIMEType:@"application/pdf" textEncodingName:@"utf-8"