Questions tagged [uiwebview]

A class used to display web content from within an iOS application. Note that UIWebView is deprecated since iOS 8, it is recommended by Apple to use WKWebView instead.

UIWebView is used to render HTML content in iOS () applications (including accompanying CSS and JavaScript). UIWebView is effectively a miniature web browser that you can embed within your app. The user can view a web page (both local or from the Internet) in the app itself instead of launching the separate Safari app. UIWebView is available in iOS 2.0 and later.

Set the delegate property for the UIWebView to an object conforming to the UIWebViewDelegate protocol if you want to track the loading of web content from your app.

Note that UIWebView is deprecated since iOS 8, it is recommended by Apple to use WKWebView instead.

Resources:

10713 questions
307
votes
10 answers

UIWebView open links in Safari

I have a very simple UIWebView with content from my application bundle. I would like any links in the web view to open in Safari instead of in the web view. Is this possible?
David Beck
  • 10,099
  • 5
  • 51
  • 88
229
votes
22 answers

Stop UIWebView from "bouncing" vertically?

Does anyone know how to stop a UIWebView from bouncing vertically? I mean when a user touches their iphone screen, drags their finger downwards, and the webview shows a blank spot above the web page I had loaded? I've looked at the following…
Brad Parks
  • 66,836
  • 64
  • 257
  • 336
170
votes
18 answers

How to load local html file into UIWebView

I'm trying to load a html file into my UIWebView but it won't work. Here's the stage: I have a folder called html_files in my project. Then I created a webView in interface builder and assigned an outlet to it in the viewController. This is the code…
madcoderz
  • 4,423
  • 10
  • 47
  • 74
169
votes
25 answers

Can I set the cookies to be used by a WKWebView?

I'm trying to switch an existing app from UIWebView to WKWebView. The current app manages the users login / session outside of the webview and sets the cookies required for authentication into the the NSHTTPCookieStore. Unfortunately new WKWebView…
Col
  • 2,300
  • 3
  • 16
  • 16
166
votes
13 answers

Using HTML and Local Images Within UIWebView

I have a UIWebView in my app which I want to use to display an image which will link to another url. I'm using to load the image. The problem is that the image doesn't load (ie. it can't be found) even though it's added as a…
Jasarien
  • 58,279
  • 31
  • 157
  • 188
146
votes
7 answers

How to Get the Title of a HTML Page Displayed in UIWebView?

I need to extract the contents of the title tag from an HTML page displayed in a UIWebView. What is the most robust means of doing so? I know I can do: - (void)webViewDidFinishLoad:(UIWebView *)webView{ NSString *theTitle=[webView…
TechZen
  • 64,370
  • 15
  • 118
  • 145
142
votes
8 answers

What are some methods to debug Javascript inside of a UIWebView?

I'm trying to figure out why something with Javascript isn't working inside of a UIWebView. To my knowledge, there is no way to set a breakpoint inside of XCode for a js file. No problemo, I'll just go back to 2004 and use alert statemen-- oh wait…
bpapa
  • 21,409
  • 25
  • 99
  • 147
140
votes
8 answers

UIWebView background is set to Clear Color, but it is not transparent

I'm developing an iOS 4 application using iOS SDK latest version and XCode 4.2. I have a XIB with a UIWebView with Alpha = 1.0, Background set to Clear Color and Opaque is not set. On this XIB I setup an image as background with this code: -…
VansFannel
  • 45,055
  • 107
  • 359
  • 626
134
votes
10 answers

Reading HTML content from a UIWebView

Is it possible to read the raw HTML content of a web page that has been loaded into a UIWebView? If not, is there another way to pull raw HTML content from a web page in the iPhone SDK (such as an equivalent of the .NET WebClient::openRead)?
Fuzzy Purple Monkey
  • 1,940
  • 3
  • 15
  • 23
133
votes
4 answers

How can I enable zoom in on UIWebView which inside the UIScrollView?

I have a UIWebView which inside a UIScrollView (scrollview contain another component) I tried to enable multitouch both on Interface Builder or Programmatic on UIWebView but it still cannot zoom for html, do I need to handle both zoom in at the…
calendarw
  • 1,511
  • 2
  • 9
  • 18
131
votes
3 answers

Migrating from UIWebView to WKWebView

I'm migrating from UIWebView to WKWebView, how can I rewrite these function for WKWebView? func webViewDidStartLoad(webView: UIWebView){} func webViewDidFinishLoad(webView: UIWebView){} and func webView(webView: UIWebView,…
Phocs
  • 2,430
  • 5
  • 18
  • 35
124
votes
12 answers

Disabling user selection in UIWebView

I have an app where I load content to a UIWebView and present this. I cannot disable user interaction completely because I want the user to be able to click links. I just need to disable user selection. I found somewhere in the Internets that you…
Engin Kurutepe
  • 6,719
  • 3
  • 34
  • 64
122
votes
8 answers

Load resources from relative path using local html in uiwebview

I have a very simple iOS app with a uiwebview loading a very simple test page (test.html): I load this test.html file into my web view: NSURL *url = [[NSBundle mainBundle]…
Matt Palmerlee
  • 2,668
  • 2
  • 27
  • 28
119
votes
8 answers

How to make a transparent UIWebView

I have an app with a UITableView and a corresponding detail view for each row. In the detail view I have to display some text and a background image (text is different for each row, but the image remains the same). The easiest way, in my opinion, is…
Knodel
  • 4,359
  • 8
  • 42
  • 66
116
votes
15 answers

How to determine the content size of a UIWebView?

I have a UIWebView with different (single page) content. I'd like to find out the CGSize of the content to resize my parent views appropriately. The obvious -sizeThatFits: unfortunately just returns the current frame size of the webView.
Ortwin Gentz
  • 52,648
  • 24
  • 135
  • 213
1
2 3
99 100