uiwebview

refreshing a tab bar item on webview

僤鯓⒐⒋嵵緔 提交于 2019-12-08 11:19:29
问题 I am newbie and need help. I built a webview app on xcode (swift), with tab bars. and I need to know, how can I refresh the tab bar, when I pressed it. how can I refresh my tab bar item, when I pressed first tab bar item? For example, twitter app. when you pressed first tab, it refreshes the wiew, and goes to main screen. here is my code; override func viewDidLoad() { super.viewDidLoad() let url = URL (string: "https://google.com") let webviewgo = URLRequest(url: url!) firstWebview

UIWebView stringByEvaluatingJavaScriptFromString isn't calling javascript function

左心房为你撑大大i 提交于 2019-12-08 11:17:12
问题 I have the following in a controller and don't understand why it is not calling the function in the page (it doesn't do anytihng). Any help is appreciated - first time using this: - (void)viewDidLoad { [super viewDidLoad]; NSString *fullURL = @"http://local.com/js-more.html"; // this does laod NSURL *url = [NSURL URLWithString:fullURL]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [arcWebView loadRequest:requestObj]; NSString * param = @"foo"; NSString * jsCallBack =

Get Attribute From Multiple Div Elements into my iOS app from UIWebView W/Swift

人走茶凉 提交于 2019-12-08 10:42:12
问题 How do I get an attribute from a div element defined in my UIWebView into my iOS app? To explain further... I have a very simple html document that I load into a UIWebView. It allows a user to click to turn buttons on or off. I set an attribute on the divs to true or false. Refer to my code below. <html> <head> <title>Tire Selection Template</title> <style> .front_truck_box{ display:flex; flex-wrap: wrap; border:1px solid black; height:80px; flex: 0 1 80px; padding:10px; } .middle_truck_box,

Parsing links from XML file and pushing it to a UIWebView

亡梦爱人 提交于 2019-12-08 10:25:02
问题 I have been trying to parse an XML file in order to get articles from a website using background fetch. The link to the tutorial is here. I've successfully completed the tutorial and parsed my XML file, but instead of pushing the link externally through safari, when the user clicks on the article I would like them to see it in a UIWebView. How would I implement this in my code? My CODE: NewsViewController.h (This file loads a uitableview that runs the background fetch to get the articles):

load image in web view from a .html file

荒凉一梦 提交于 2019-12-08 10:23:53
问题 How can I load an image in iphone webview from a .html file? 回答1: Easy NSString *bundlePath = [[NSBundle mainBundle] bundlePath]; NSURL *bundleBaseURL = [NSURL fileURLWithPath: bundlePath]; NSLog(@"webview %@", bundlePath); NSString *filePath = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]; NSData *htmlData = [NSData dataWithContentsOfFile:filePath]; NSString * html = [NSString stringWithContentsOfFile:filePath encoding:NSStringEncodingConversionAllowLossy error:nil]; if

Opening tel: links from UIWebView

心不动则不痛 提交于 2019-12-08 10:15:32
I've searched and searched, but I can't seem to find a fix for this problem. For some reason, I can not get 'tel:' links to work in a UIWebView. When the links are clicked, the message "The URL can't be shown" appears. Clicking on the same link in Safari works perfectly and dials the number. This problem started with iOS 5. These links worked perfectly in iOS 4.2 and 4.3. I'm not sure what other information might be useful, so please let me know if I need to clarify. Thanks! EDIT: Here is the actual code in use... - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *

Remove hyperlinks in uiwebview

ⅰ亾dé卋堺 提交于 2019-12-08 10:05:02
问题 I am trying to load a html page through UIWebview.I need to disable all the hyperlinks in webview and make its color to normal text color i.e i need to disable webpage detection.Is that possible Thanks in advance 回答1: Use this UIWebView method – stringByEvaluatingJavaScriptFromString: To use Javascript. Then use " document.getElementsByTagName('a') " to get an Array of elements and do want you want (change the href, change the color etc.) 来源: https://stackoverflow.com/questions/3880250/remove

How do I catch UIWebView errors in MonoTouch?

痴心易碎 提交于 2019-12-08 10:02:47
问题 Here's an answer for a similar question in Objective C but I'm not sure what's the right way to translate it to MonoTouch. Basically, I want to be able to catch JavaScript errors and know at least filename and line number—unfortunately, window.onerror doesn't give this crucial information. In particular, I'm not sure if I should expose a native library or if I can write this in pure MonoTouch. 回答1: I adopted Pablo's UIWebView+Debug category inspired by Robert Sanders and Kresimir Prcela's

Injecting JavaScript into UIWebView

怎甘沉沦 提交于 2019-12-08 09:55:02
问题 I am trying to use the stringByEvaluatingJavaScriptFromString: to alter a WebView and it's not executing as I expect. Here is the code, this JS doesn't execute though. Any idea why? UIWebView *wv = [UIWebView alloc] init]; NSURL *url = [[NSURL alloc] initWithString:@"http://www.google.com"]; NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url]; [wv loadRequest:request]; [wv stringByEvaluatingJavaScriptFromString:@"document.write('This Works')"]; 回答1: Probably you'll have to wait for

Set loading gif in UIWebView while it's loading

最后都变了- 提交于 2019-12-08 09:54:28
问题 I'm searching for an easy method to display a custom loading .gif or another image as long as a UIWebView is still loading the page. I know I have to do it in – webViewDidStartLoad:(UIWebView *)webView But how do I load the image? 回答1: try this : – webViewDidStartLoad:(UIWebView *)webView { UIImageView *animatedImages; NSMutableArray *imageArray; // Array to hold jpg images imageArray = [[NSMutableArray alloc] initWithCapacity:IMAGE_COUNT]; // Build array of images, cycling through image