uiwebview

iPhone keyboard in UIWebView does not go away

牧云@^-^@ 提交于 2019-11-30 07:18:31
问题 I have an UIWebView that loads a HTML form. When I select a text field the keyboard appears. When I type and hit "Go" the form is submitted and the next page loads, but the keyboard does not go away, it stays on the screen. The only way to get rid of the keyboard is to press the 'done' button on the keyboard or press the HTML submit button in the form. Is it possible to make the keyboard disappear after hitting the Go button? Thanks! 回答1: You need to have the active input resign the focus as

iPhone Development: Grabbing selected/highlighted text on UIWebView

让人想犯罪 __ 提交于 2019-11-30 07:16:01
Greetings, Please kindly advice on how possibly I can get the selected text on UIWebVIew . I went on to search on how to deal with selected/highlighted text and found the following: Selection and Menu Management To copy or cut something in a view, that “something” must be selected. It can be a range of text, an image, a URL, a color, or any other representation of data, including custom objects. To implement copy-and-paste behavior in your custom view, you must manage the selection of objects in that view yourself. If the user selects an object in the view by making a certain touch gesture

JQuery Mobile not working inside UIWebView

本小妞迷上赌 提交于 2019-11-30 07:04:26
I'm coming here after many many hours of looking for a solution and trying different approaches to fix this issue I'm having with JQuery Mobile and my iPad app. What I'm trying to do is a reporting app with Fusion Charts. I have successfully rendered the charts within web views (UIWebView) using different methods, and following different examples, but what I'd like to do now is accomplishing the same task using the JQuery Mobile framework. I'm not using phonegap and I've followed the steps to the letter regarding JQuery Mobile + Xcode integration (I think). The charts load without a problem on

Get notified about a page change in UIWebView

守給你的承諾、 提交于 2019-11-30 06:55:33
I'm curious if there's a way to detect a change of the displayed website inside a UIWebView . In an app I'm working on we're using a UIWebView to present a part of the functionality which are basically a few steps the user needs to follow. However, the will be a specific page at the end of these steps that I need to identify and after which the app needs to display a different view. Unfortunately the UIWebViewDelegate doesn't seem to do the trick. If the user steps are separated on different pages, and the UIWebView needs to load the different steps, this should indeed be possible with the

Why does clearing NSUserDefaults cause EXC_CRASH later when creating a UIWebView?

丶灬走出姿态 提交于 2019-11-30 06:51:15
问题 Before I begin, I should tell you that this only happens in iOS 5.1. Before the most recent update, this had never happened and it still does not happen on any other version. That said, here's what's going on. When a user logs out of my app, one of the things that happens is that all of the NSUserDefaults get deleted. Rather than manually removing every key I might add to the user's defaults, I just completely delete all of the NSUserDefaults , using the method suggested in this SO question:

UIWebView: Can I disable the javascript alert() inside any web page?

醉酒当歌 提交于 2019-11-30 06:46:01
问题 I am using UIWebView to load a URL. Inside the page of that URL, it uses alert("whatever msg") as JavaScript. My UIWebView will pop up a window and show that alert message. Is there a way to disable this kind of popup window or JavaScript alert window? 回答1: Add this after your web view has loaded its content [MyWebView stringByEvaluatingJavaScriptFromString:@"window.alert=null;"]; 回答2: You can bind window.alert to another function. So: window.alert = function() { //does nothing so effectively

Rendering a UIWebView into an ImageContext

瘦欲@ 提交于 2019-11-30 06:39:46
问题 I am trying to capture the contents of a UIWebView including that which is not visible to the user. i.e. The whole web page even though the user is only looking at the top. Looking around I found the best way to capture a UIView is to retrieve its layer and use renderInContext. However, UIWebView seems to be using its own CALayer implementation which is behaving a lot more like CATiledLayer, although it is still claiming to be a standard CALayer. When I call renderInContext I only get one

Has anybody found a way to load HTTPS pages with an invalid server certificate using UIWebView?

牧云@^-^@ 提交于 2019-11-30 06:35:21
问题 If a user attempts to load a https web page in Mobile Safari and the server's certificate validation check fails (its expired, revoked, self-signed etc.) then the user is presented is presented with a warning message and asked if they want to continue or not. Similarly NSURLConnection offers the ability for the implementator to decide firstly how to check the certificate and then decide how to proceed if it fails, so in this situation too it would be possible to display a warning to the user

UIWebView Doesn't Load Completely, Height Varies

你离开我真会死。 提交于 2019-11-30 06:30:10
问题 I have a view controller containing some labels and a UIWebView that is loading some html in it. All these labels and UIWebView are subviews of a UIScrollView. I have disabled the scrolling of UIWebView so the labels and UIWebView scrolls all together inside the UIScrollView. Then i took found the size of the content inside the UiWebView, changed the UIWebView size according to the content size and then set the size of the scroll view to the size of the webview. This is how i did it by adding

How to get JSContext from WKWebView

房东的猫 提交于 2019-11-30 06:27:55
In UIWebView, I can get JSContext through: [webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"] The same way doesn't work in WKWebView and app crashes when it arrives this line of code. Is there a way to get JSContext in WKWebView? thanks in advance. You cannot obtain the context, because layout and javascript is handled on another process. Instead, add scripts to your webview configuration, and set your view controller (or another object) as the script message handler. Now, send messages from JavaScript like so: window.webkit.messageHandlers.interOp.postMessage