uiwebview

Save PDF which is displayed by UIWebView locally

橙三吉。 提交于 2019-12-03 03:59:22
I have a UIViewController with an UIWebView which displays a pdf file depending which row was clicked before in an UITableView . Now I want to add a button for the user to save this pdf file locally for offline use. Then there is a second UITableView which should display the name of the saved pdf and by clicking on it another UIViewController appears and displays the saved pdf on a UIWebView offline. What would be a good way to start? Thanks Sergey Kuryanov You can try this way: 1) Add a button to the View containing UIWebView 2) At button press save the file shown in UIWebView (note: in iOS 5

How to get all <img src> of a web page in iOS UIWebView?

你离开我真会死。 提交于 2019-12-03 03:58:59
问题 everyone. I'm trying to get all image urls of the current page in UIWebView. So, here is my code. - (void)webViewDidFinishLoad:(UIWebView*)webView { NSString *firstImageUrl = [self.webView stringByEvaluatingJavaScriptFromString:@"var images = document.getElementsByTagName('img');images[0].src.toString();"]; NSString *imageUrls = [self.webView stringByEvaluatingJavaScriptFromString:@"var images= document.getElementsByTagName('img');var imageUrls = "";for(var i = 0; i < images.length; i++){var

How to add customize HTTP headers in UIWebView request, my UIWebView is based on Cordova project?

徘徊边缘 提交于 2019-12-03 03:54:59
My iOS UIWebView page is based on Cordova open source framework, and I want to add some customize http headers in its webview URL request, my solution is to add them in the following UIWebView delegate method. Debug shows that headers are added successfully, but in fact the request doesn't bring them out. Using Wireshark to capture network packets and found only standard headers are available, no my customize ones. My testing is based on simulator (iOS 7.1), anyone who has experience on this topic please share and discuss together, thanks in advance. - (BOOL)webView:(UIWebView *)webView

Embedded vimeo video in iPhone app using iOS 6 not playing

大城市里の小女人 提交于 2019-12-03 03:52:40
I can't seem to get any videos playing in iOS 6. Both on the device (iP4) and simulator. What I have is a UIWebView setup in IB. Then in my viewDidLoad I have the following code: NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://domain.com/app/player.php?vid=%@", [videoDetails objectForKey:@"vid"]]]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [videoWebView loadRequest:requestObj]; Just to explain, the video settings on vimeo are that it is only allowed to be hosted on a specific domain, otherwise it will display an error message. So I have some simple

IOS UIWebView: How to add listeners to DOM events?

烂漫一生 提交于 2019-12-03 03:44:06
How can I add listeners to DOM events in UIWebView? For example for the following html: <button type="button" id="button1">Try it</button> Is it possible to register a listener for a button click event in IOS application that loads html in UIWebView? Yes, you can do this with crafted url and UIWebViewDelegate methods. First, to add event listener on button tag, you should execute javascript like below (after the page is loaded) // In the UIWebViewDelegate - (void)webViewDidFinishLoad:(UIWebView *)webView { if (/* when the loaded url is the target */) { NSString *js = @"document.getElementById(

even basic Ionic project with Cordova WKWebview Engine plugin produces white screen

夙愿已清 提交于 2019-12-03 03:37:58
My problem: The ionic app I'm developing is horribly slow, after finding out UIWebView is the culprit I'm looking for ways to speed it up, with WKWebView being the most promising solution. What my project looks like: When setting up a sample ionic project ( http://ccoenraets.github.io/ionic-tutorial/install-ionic.html for example) with the current Cordova 4.1.0 CLI (i'm using Ionic 1.2.4) UIWebView is used as default. However, since Cordova 4, the new and faster WKWebView is supported out-of-the-box and can be forced, at least in iOS 9 ( cordova 4 supports WKWebView ). The plugin I used &

UIWebViewDelegate: webViewDidFinishLoad not called during in-page navigation

我与影子孤独终老i 提交于 2019-12-03 03:33:53
I have an app where users can navigate a pile of locally stored HTML files. I have a UIWebView , configured up correctly with a UIWebViewDelegate . Usually, when the user follows a link, shouldStartLoadWithRequest is called, followed by webViewDidFinishLoad a bit later. But, if the link is pointing to an anchor on the same page as the one which is currently displayed, only shouldStartLoadWithRequest is called. webViewDidFinishLoad does not fire. In a sense, I see that this might be expected behaviour, because in-page navigation should not require a page reload. However, I really need a place

How to hide “Now playing url” in control center

陌路散爱 提交于 2019-12-03 03:28:10
I am trying to hide livestream urls that are playing in an UIWebView . When you play a livestream url and open control center (iOS) you see the url that is playing: . I would like to hide that with a HTML-based or xcode-based script. You can control this information with the MPNowPlayingInfoCenter . The defaultCenter 's nowPlayingInfo dictionary controls what is displayed about the current audio track on the lock screen and command center. MPNowPlayingInfoCenter *infoCenter = [MPNowPlayingInfoCenter defaultCenter]; NSDictionary *nowPlayingInfo = @{ MPMediaItemPropertyTitle : @"Media Name",

Hide shortcut keyboard bar for UIWebView in iOS 9

让人想犯罪 __ 提交于 2019-12-03 03:21:13
I'm developing PhoneGap application for iOS and I need to get rid of new iOS 9 shortcut bar. Now I'm doing the following in the - (void)viewDidLoad method if ([self.webView respondsToSelector:@selector(inputAssistantItem)]) { UITextInputAssistantItem *inputAssistantItem = [self.webView inputAssistantItem]; inputAssistantItem.leadingBarButtonGroups = @[]; inputAssistantItem.trailingBarButtonGroups = @[]; } This hides undo/redo and copy/paste buttons but shortcut bar still presented on keyboard and has navigation buttons on it. How can I get rid of shortcut bar completely. Thanks for your help!

New error in iOS 5: WebKit discarded an uncaught exception

我的梦境 提交于 2019-12-03 03:18:33
I am trying to load a UIWebView with the Facebook OAuth authorization URL and I am using the following code. When my UIWebView loads with Facebook login page, I enter my credentials, then press the "Log in" button. When I hit the button I am getting the following error: WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener:delegate: Application tried to present modally an active controller . This same code works fine with iOS 4.3 and previous versions, but it doesn't work in iOS 5.0. I don't understand the problem, can anyone