uiwebview

Downloading files from uiwebview in iphone sdk

南笙酒味 提交于 2019-12-03 09:04:26
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 ressource form the UIWebView's request URL NSString *filename = [theRessourcesURL lastPathComponent]; NSLog(@

IOS 7 Safari like History dragging gesture using uiwebview

断了今生、忘了曾经 提交于 2019-12-03 09:04:00
If you see in ios 7 safari app have left and right dragging to see history of webpages. It also show content of previous page while dragging . I want similar functionality using UIWebiview. I can get forward and backward page but how that dragging functionality with displaying previous content will be implemented? Note: this is iOS 7 only. For iOS 6 you should use the PanGestureRecognizer and detect if it's left or right. Your need two properties: @property (nonatomic, strong) UIImageView * imgvcChild1; @property (retain, strong) IBOutlet UIWebView *webView; First of all, add the gesture

Disable copy and paste in UIWebView

Deadly 提交于 2019-12-03 08:54:50
Nearly, I had tried every thing to disable copy/paste in UIWebView but nothing worked with me. I'm loading my UIWebView from a string (array of strings) as follows: [webView loadHTMLString: [NSString stringWithFormat:@"%@<p class=\"paragraph\" style=\"float: right\" >%@</p>",css,[[array objectAtIndex:0] valueForKey:@"content"]] baseURL:nil ]; I had tried this: -(void)webViewDidFinishLoad:(UIWebView *)webView1{ [webView1 stringByEvaluatingJavaScriptFromString:@"document.body.style.webkitUserSelect='none';"]; } and this: NSString *css = @"<head><style><body> *{-webkit-touch-callout: none;

iOS UIWebView leaked

故事扮演 提交于 2019-12-03 08:51:32
问题 class MyViewController: UIViewController { @IBOutlet weak var webView: UIWebView? override func viewDidLoad() { super.viewDidLoad() let url = NSURL(string: urlString) let request = NSURLRequest(URL: url!) SVProgressHUD.show() webView?.loadRequest(request) webView?.scrollView.header = MJRefreshNormalHeader(refreshingBlock: { [weak self] in if let strongSelf = self { strongSelf.webView?.reload() }}) } override func viewDidDisappear(animated: Bool) { super.viewDidDisappear(animated)

UIWebView: webViewDidStartLoad/webViewDidFinishLoad delegate methods not called when loading certain URLs

◇◆丶佛笑我妖孽 提交于 2019-12-03 08:48:11
问题 I have basic web browser implemented using a UIWebView . I've noticed that for some pages, none of the UIWebViewDelegate methods are called. An example page in which this happens is: http://www.youtube.com/user/google. Here are the steps to reproduce the issue (make sure you insert NSLog calls in your controller's UIWebViewDelegate methods): Load the above youtube URL into the UIWebView [notice that here, the UIWebViewDelegate methods do get called when the page loads] Touch the "Uploads"

UIWebView show UIActivityIndicator for loading but ignore additional load requests (e.g. javascript loaded advertisements) after page initially loads

帅比萌擦擦* 提交于 2019-12-03 08:43:57
This is a Q&A post. To inform the many other users I saw who struggled with this issue as I browsed through StackOverflow's database. None of these users ever got a solid answer (and most of them were posing the question years ago so I wasn't going to bump the post). The issue many struggled with is as follows: When you try to load a page in a UIWebView and the page then loads another page maybe via an iFrame or it loads an advertisement through javascript you end up getting the page loading function called again and if you are using a UIActivityIndicator it will get called again as well and

Printing Pdf using AirPrint causes small output

时间秒杀一切 提交于 2019-12-03 08:41:43
I trying to print a pdf with UIPrintInteractionController that it load in the UIWevView . The good news is that i can print the bad is that the output of the print is to small. any help would be appreciated :) - (IBACTION) printPDF { if ((!_webView)) return; UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController]; void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) { if(!completed && error){ NSLog(@"FAILED! due to error in domain %@ with error code

Safari - iPhone simulator debugging (via “develop”) not showing anymore

本小妞迷上赌 提交于 2019-12-03 08:40:46
问题 I am using iPhone simulator to run a UIWebview, and Safari browser (on my mac) in order to debug the js / html / css code (via "develop" menu -> iPhone Simulator -> choosing my webview). Yestarday, the iPhone-simulator option disappeared from my "develop" menu: (as you can see, the "iphone-simulator" is missing here (it is opened in the background and working...) Any idea? Edit: I am using iOS 7 iPhone simulator + Safari 7 Edit 2: Just tried opening a website on iphone-simulator's Safari

Archive/Unarchive UIWebView?

拜拜、爱过 提交于 2019-12-03 08:36:01
I would like to save the current state of an UIWebView to disk in IPhone SDK. I have a UIWebView that loads a website with lots of javascript. I would like to save the UIWebView state, maintaining the state of the javascript variables, http cookies, etc. at that moment. Then at a later time, I would like to unarchive the UIWebview and display it on the screen with the exact same state as it was when it was archived. Is this possible? I tried to do this on a previous project and there's no built-in serialization of UIWebView. There's a couple of ways to cache just the page but not the entire

When can I use a SFSafariViewController, WKWebView, or UIWebView with universal links?

十年热恋 提交于 2019-12-03 08:32:06
问题 In the Universal Links section of the iOS App Search Programming Guide, Apple says: If you instantiate a SFSafariViewController, WKWebView, or UIWebView object to handle a universal link, iOS opens your website in Safari instead of opening your app. However, if the user taps a universal link from within an embedded SFSafariViewController, WKWebView, or UIWebView object, iOS opens your app. What does "handle a universal link" mean? Can I not ever open the given URL with an