uiwebview

UIWebView - creating custom context menu?

无人久伴 提交于 2020-01-11 19:58:42
问题 I added UIWebView control to my application. To disable default context menu, I implemented webViewDidFinishLoad. - (void) webViewDidFinishLoad:(UIWebView *)theWebView { NSString *varMySheet = @"var mySheet = document.styleSheet[0];"; NSString *addCSSRule = @"function addCSSRule(selector, newRule) {" "if (mySheet.addRule) {" "mySheet.addRule(selector, newRule);" "} else {" "ruleIndex = mySheet.cssRules.length;" "mySheet.insertRule(selector + '{' + newRule + ';}', ruleIndex;" "}" "}"; ...

UIWebView - creating custom context menu?

丶灬走出姿态 提交于 2020-01-11 19:58:08
问题 I added UIWebView control to my application. To disable default context menu, I implemented webViewDidFinishLoad. - (void) webViewDidFinishLoad:(UIWebView *)theWebView { NSString *varMySheet = @"var mySheet = document.styleSheet[0];"; NSString *addCSSRule = @"function addCSSRule(selector, newRule) {" "if (mySheet.addRule) {" "mySheet.addRule(selector, newRule);" "} else {" "ruleIndex = mySheet.cssRules.length;" "mySheet.insertRule(selector + '{' + newRule + ';}', ruleIndex;" "}" "}"; ...

Unreproducible webcore crashes

﹥>﹥吖頭↗ 提交于 2020-01-11 18:50:37
问题 I've got an iPad app that's in the App Store for around three months now and I've been receiving some weird crash reports that I can't figure out. These are not that frequent, got around 15-20 instances since the launch but still frequent enough to actually bug me. The crashes are slightly different (see stack traces below) but since they are related to WebCore I'm guessing they have to do with the usage of the UIWebView in the app and might have a common cause, though I'm not 100% positive.

Xamarin iOS Universal Links support for Twitter Auth

帅比萌擦擦* 提交于 2020-01-11 12:59:34
问题 So, now twitter from 25 sep supports universal linking, it means that when UIWebView hits https://twitter.com/oauth/authorize?oauth_token link, it tries to open a twitter app, and if it is there, then it redirects me to auth page with auth error, so I wonder, how can I disable it from code, without uninstalling twitter app, or how I can enable universal linking auth in my xamarin ios app? Is it possible at all? (similar question but for native: Disable Twitter Universal Deep Links) 回答1:

How to change UIWebView orientation programmatically in Swift

笑着哭i 提交于 2020-01-11 11:48:31
问题 I've created UIWebView programmatically. Now i want to set programmatically its orientation to (landscape or portrait). Please can anyone tell me how i can do this? Thanks import UIKit class ViewController: UIViewController, UIWebViewDelegate { override func viewDidLoad() { super.viewDidLoad() let webV:UIWebView = UIWebView(frame: CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height)) webV.loadRequest(NSURLRequest(URL: NSURL(string: "http://tune.tv/humtv

Passing geolocation fetched from the app to the UIWebView

六眼飞鱼酱① 提交于 2020-01-11 07:16:28
问题 I'm developing the iOS app and in one of the views I would like to include UIWebView with a page that contains a map (the address is: https://carsharing.mvg-mobil.de). The website requires location permission so as soon as the user is presented with this view, an alert appears: "https://carsharing.mvg-mobil.de/ would like to use your current location. OK/Don't allow". In my app I have the location of the user fetched from the CoreLocation framework. Is there a way to pass this location to

Get UIWebView response header

怎甘沉沦 提交于 2020-01-10 19:36:41
问题 I have looked into ways to get response header from UIWebview response. This SO question discusses it. But I am unsure if this is allowed by apple. I will have a webview showing a loaded login page and need to get the response headers after a successful login. Also this does something to get status code. But it create a duplicate NSUrlConnection request. Is there any way by which I can achieve this? I would appreciate any information on this. 回答1: In addition to the answer provided by DBD,

Injecting a new stylesheet into a website via uiwebview using iOS8 Swift XCode 6

﹥>﹥吖頭↗ 提交于 2020-01-10 05:27:06
问题 I've seen a few options on here using just Objective-C, but I'm having trouble doing this with Swift iOS8 in XCode 6. I'm using the uiwebview to load a website. For sake of example, let's say its google.com. @IBOutlet var website: UIWebView! var url = "http://www.google.com" func loadUrl() { let requestURL = NSURL(string: url) let request = NSURLRequest(URL: requestURL!) website.loadRequest(request) } override func viewDidLoad() { super.viewDidLoad() website.delegate = self loadUrl() } func

Load image in local HTML file — UIWebView

浪尽此生 提交于 2020-01-10 03:27:07
问题 I load a local HTML file in a UIWebView like so: [webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]isDirectory:NO]]]; In my index.html, how do I load a display a local image (added to project through Xcode) with img src="..."/> ? 回答1: Instead of loading with an NSURLRequest , read the html file into an NSString and create an NSURL to the directory with image files. Then use UIWebView's - (void)loadHTMLString

How to get selection text from UIWebView?

吃可爱长大的小学妹 提交于 2020-01-09 13:09:33
问题 , Hello, everyone. I'm developing my app which has a feature to post article from website. This is a picture of UIWebview with UIMenuController. It was possible to get event when user tap the button. but I can't find the way to get the text the user selected. In UITextView case, it has 'selectedRange' property, so it is easy to get selection text. UIMenuItem *facebookMenuItem = [[UIMenuItem alloc] initWithTitle:@"Facebook" action:@selector(facebookMenuItemTapped:)]; UIMenuItem