uiwebview

autofill username and password in an HTML page opening in UIWebView

僤鯓⒐⒋嵵緔 提交于 2020-01-04 06:23:07
问题 How to find login form using RegsEx when using UIWebView to autofill data ? I have used following code to get all form data: int NoOfForms = [[self.browser stringByEvaluatingJavaScriptFromString:@"document.forms.length"] intValue]; NSMutableArray *formData = [[NSMutableArray alloc] initWithCapacity:0]; for (int i = 0 ; i < NoOfForms ; i++) { // total number of elements in each form int elementsInForm = [[self.browser stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document

Background Loading a url in a uiwebview

假如想象 提交于 2020-01-04 03:18:16
问题 Hi I'm a have an app in which i load webpage in a uiwebview .So each time it takes too much time for loading . So i need to load the webpage in a background mode. Any one know how to done this. Any help would be appreciable. 回答1: - (void) start_Web_View { UIWebView *wv = [[UIWebView alloc] initWithFrame:CGRectMake(0,0,320,460)]; wv.delegate = self; [wv loadRequest: [NSURLRequest requestWithURL: @"http://long_loading_web_site"]]; // go do something else to amuse the user while the web site

setting ios UserAgent via NSUserDefaults: works half the time?

£可爱£侵袭症+ 提交于 2020-01-04 02:42:08
问题 This is driving me crazy. I have two apps that are just UIWebViews, using XCode 4.5.2 and the iOS 6.0 SDK. I want to change the UserAgent of the web calls. I'm using this code in both: NSString *secretagent = @"MyUserAgent"; NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:secretAgent, @"UserAgent", nil]; [[NSUserDefaults standardUserDefaults] registerDefaults:dictionary]; What's killing me is that it works in one and not in the other, based on my scanning of the web

How can I play a Youtube video in an iPhone

淺唱寂寞╮ 提交于 2020-01-03 20:57:08
问题 I wanted to play a Youtube video in the iPhone from within the application. I tried using the MPMoviePlayerController, but was not loading the video. It is playing the video which I loaded from the bundle but not the you tube video. I also tried to play the Youtube video by embedding it in the UIWebView, but that also was in vain. Can anybody suggest me an approach that i should take. i am testing it in the IOS 4.2 This is the code i used. mp = [[MPMoviePlayerController alloc]

How can I play a Youtube video in an iPhone

混江龙づ霸主 提交于 2020-01-03 20:57:04
问题 I wanted to play a Youtube video in the iPhone from within the application. I tried using the MPMoviePlayerController, but was not loading the video. It is playing the video which I loaded from the bundle but not the you tube video. I also tried to play the Youtube video by embedding it in the UIWebView, but that also was in vain. Can anybody suggest me an approach that i should take. i am testing it in the IOS 4.2 This is the code i used. mp = [[MPMoviePlayerController alloc]

uiwebview not loading request even with delegate = self

回眸只為那壹抹淺笑 提交于 2020-01-03 16:44:22
问题 I have created a NSObject class and included , in the init i create a uiwebview set the delegate to self and send the load request. For some reason webViewDidFinishLoad or didFailLoadWithError never get fired. I can't figure why. // // RXBTest.h #import <Foundation/Foundation.h> @interface RXBTest : NSObject <UIWebViewDelegate> @end // RXBTest.m // pageTest #import "RXBTest.h" @implementation RXBTest - (id) init { if((self=[super init])){ UIWebView* webView = [[UIWebView alloc] initWithFrame

uiwebview not loading request even with delegate = self

给你一囗甜甜゛ 提交于 2020-01-03 16:44:05
问题 I have created a NSObject class and included , in the init i create a uiwebview set the delegate to self and send the load request. For some reason webViewDidFinishLoad or didFailLoadWithError never get fired. I can't figure why. // // RXBTest.h #import <Foundation/Foundation.h> @interface RXBTest : NSObject <UIWebViewDelegate> @end // RXBTest.m // pageTest #import "RXBTest.h" @implementation RXBTest - (id) init { if((self=[super init])){ UIWebView* webView = [[UIWebView alloc] initWithFrame

Calculate UIWebView Content dynamic Height using 'document.body.scrollHeight;' returns bigger value in iOS 10

我与影子孤独终老i 提交于 2020-01-03 08:15:14
问题 I am creating on an application using Objective C, where I'm using a UIWebView to display contents in HTML format. I am using below code in UIWebView delegate method webViewDidFinishLoad NSUInteger contentHeight = [[aWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.body.scrollHeight;"]] intValue]; to calculate the webview content height, this is working fine in iOS8 , iOS9 and iOS11 but in iOS10 iPhone mobiles the content height returning a much bigger

Set WKWebViewConfiguration on WKWebView from Nib or Storyboard

半城伤御伤魂 提交于 2020-01-03 07:21:06
问题 With iOS 11 Apple has added the ability set add WKWebViews outlets on your nibs and storyboards. It seems to work fine when using the default WKWebViewConfiguration that get set automatically. However, I'd like to be able to use a custom WKWebViewConfiguration. Is there anyway I can set this before, or after the WKWebView gets initialized from the nib? 回答1: Let's Example your customize configuration. NSString *jScript = @"var meta = document.createElement('meta'); meta.setAttribute('name',

How to test UIWebView's 10MB limit on JavaScript?

走远了吗. 提交于 2020-01-03 05:38:09
问题 I'm trying to test UIWebView's 10MB limit on Javascript memory allocation. Here is my code so far which I'm running on the simulator (iOS 5.1). int size = 10485760+1024000*10; int i = 13; char *cStr = (char *) malloc(size); // 20MB buffer char *lcStr = cStr; lcStr+=i; strcpy(cStr, "window._x = \'"); for ( ; i < size-4; i++){ if(i%2){ *lcStr = ' '; }else{ *lcStr = 'c'; } lcStr++; } strcpy(lcStr, "c\';\0"); NSString *longStr = [NSString stringWithCString:cStr encoding:NSASCIIStringEncoding]; //