uiwebviewdelegate

how does one check if UIWebView is empty or not

限于喜欢 提交于 2019-12-21 04:37:04
问题 I need to check if a webview when completed loading has any content or not. What I require is simple. Its a small webview strip at the bottom of my pages (like an advert) I call NSURLRequest *request=[NSURLRequest requestWithURL:adURL]; [gWebView loadRequest:request]; I get the callback -(void)webViewDidFinishLoad:(UIWebView *)webView { But in my scenario the webview shall return empty and sometime it shall have data. I do not want to show the webview if my server php file returned nothing.

iOS - UIWebViewDelegate intercept javascript calls

前提是你 提交于 2019-12-19 04:58:56
问题 I'm using pretty much the this process oulined here to allow javascript to call objective c from my iPad app: http://www.stevesaxon.me/posts/2011/window-external-notify-in-ios-uiwebview/ My javascript code that I'm injecting into the page is: <script type="text/javascript">; window.external = { 'Set_A': function(s) { document.location = 'qms://Set_A?param=' + s; }, 'Get_A': function(s) { document.location = 'qms://Get_A'; }, 'Set_B': function(s) { document.location = 'qms://Set_B?param=' + s;

How to load a url link that is inside a web view and keep it in that web view in SWIFT

不打扰是莪最后的温柔 提交于 2019-12-18 09:40:05
问题 I have a web view that has a webpage with links at the bottom. I have a way to deal with them being clicked, but all it does is open them into a new safari browser. This is not what I want.I would like for them to stay inside the web view and allow me to navigate them easily like that. Is there a way to do this? I have tried just using a regular web view, but then the links at the bottom will not work. Here is what I have so far: class ViewController: UIViewController, UIWebViewDelegate {

How to detect when a UIWebView has completely finished loading?

你离开我真会死。 提交于 2019-12-18 03:55:09
问题 I am trying to build a filter for a UIWebView and I am struggiling to detect when the UIWebView has completely finished loading. I have used the following two methods – webView:shouldStartLoadWithRequest:navigationType: – webViewDidFinishLoad: but the issue is that these will be called multiple times when a page has frames and additional content to load. What I need is to know when the view has completely loaded and there is no more content to fetch. Then when the content has loaded I can

Open WebView links in Safari

烈酒焚心 提交于 2019-12-11 18:09:08
问题 When Running the app it first loads, then loads the web page in safari. How would I make the page load in the UIWebView and have the external links in the webView open in safari? Here is some of the Code of The webviewcontroller.m - #import "WebViewController.h" @implementation WebViewController @synthesize webView; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { // Initialization code

uiwebviewdelegate not called from non-visible uiwebview

情到浓时终转凉″ 提交于 2019-12-11 11:08:09
问题 I am trying to avoid the blank white window that shows while a UIWebView loads content. Instead of putting a background on the UIWebView, I'd like to just put up a HUD on the current window and then push the new uiviewcontroller that contains the uiwebview when the content is loaded. Here's what I've done (code shortened for sanity's sake): FirstView: MyViewController *myVC = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil]; myVC.parentController = self

Multiple UIWebViews, how do I track webViewDidFinishLoad for both?

北慕城南 提交于 2019-12-11 04:48:31
问题 I've tried: - (void) webViewDidFinishLoad:(UIWebView *)webView1{ } - (void) webViewDidFinishLoad:(UIWebView *)webView2{ } Errors are that I can't redefine the same method. If I have to use the same method, I need to figure out some way of identifying one webView from the other, how would I do this? Cheers 回答1: - (void) webViewDidFinishLoad:(UIWebView *)webview{ if ( webview == self.webview1 ) { // in case of webview 1 } else if ( webview == self.webview2 ) { // in case of webview 2 } else {

iOS UIWebView page load observability

℡╲_俬逩灬. 提交于 2019-12-11 01:14:31
问题 I would like to know for sure, when a page load is finished in UIWebView . I am aware of the "refcounting" approach between didStartLoad / didFinishLoad outlined in here and it kinda-sorta works for me, but i don't feel very confident about it. It has grown some hairy ifs and still acts strangely when Javascript decides to talk into document.location . I am unclear namely about the following: UIWebViewDelegate for all the power it should handle, is very terse and has next to none

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

我怕爱的太早我们不能终老 提交于 2019-12-10 11:24:39
问题 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];

How to find last load of UIWebView(Ready State 4)

不羁岁月 提交于 2019-12-10 02:43:26
问题 I have a problem with the didFinishLoad method in UIWebView that is keeps firing. I want to try the estimatedProgress solution, however I dont know where to find those frameworks unfortunately. I am running Mountain Lion and using the latest version of XCode. Also, for the UIWebView firing multiple times, is this the best way to go or are there new methods. There seems to be a javascript answer on SO, however that did not work for me. That was dated back in 2009, and I hear that Apple rejects