Nic Hubbard
Nic Hubbard

Reputation: 42139

iOS: UIWebView full open source browser?

Does anyone know if there are any open source solutions out there that use UIWebview to build a full browser? There is something like this in Three20 when you pass a URL, but I am assuming there must be other alternatives out there.

I realize that UIWebView is a web browser, but hooking up refresh, back button, URL bar, etc will take extra time.

Suggestions?

Upvotes: 4

Views: 13981

Answers (5)

cainz
cainz

Reputation: 79

https://github.com/ghostery/banshee

EDIT the project is now maintained here: https://github.com/acatighera/banshee

It's an open source browser with tabs, bookmarks, search, etc.

enter image description here

Upvotes: 5

dfmuir
dfmuir

Reputation: 2088

You can also check out KINWebBrowser, a drop in web browser module for your apps. https://github.com/dfmuir/KINWebBrowser

Features

  • iOS 7 & 8 support for iPhone and iPad
  • Customizable UI
  • Portrait and landscape orientation support
  • Use with existing UINavigationController or present modally
  • Load URL from NSURL or NSString
  • Delegate protocol for status callbacks
  • Action button to allow users to copy URL, share, or open in Safari & Google Chrome
  • Supports subclassing
  • Installation with CocoaPods

Upvotes: 1

Sylverb
Sylverb

Reputation: 939

I have started an open source project (MIT License) to make something as close as possible to the native MobileSafari application (on iPhone and iPad).

Here are the features so far :

  • Design close to Mobile Safari (iOS 4.x) native application (for both iPhone and iPad)
  • Bookmark support (support for folders in bookmarks not implemented yet)
  • Mail link support
  • Print web page support
  • Long tap handling (open or copy link) with customizable menu

Anyone wanting to contribute to this project is welcome to do it !

You can clone/fork the project here : https://github.com/sylverb/CIALBrowser

Upvotes: 5

Srikar Appalaraju
Srikar Appalaraju

Reputation: 73608

UIWebView is a full browser ! To open a url in webView you do this -

NSURL *url        = [NSURL URLWithString:webAddress];
NSURLRequest *req = [NSURLRequest requestWithURL:url];
[webView loadRequest:req];

You can even insert javascript into UIWebView. You could customize it to your liking.

//To customize the look & feel...
self.webView.scalesPageToFit     = YES;
self.webView.autoresizingMask    = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
self.webView.autoresizesSubviews = YES;

//To insert Javascript
NSString *jsCommand = [NSString stringWithFormat:@"document.body.style.zoom = 0.5;"];
[self.webView stringByEvaluatingJavaScriptFromString:jsCommand];

You could do lot more. Have fun...

UPDATE: To get a back button and all, webView provides those features, back, forward etc. all those browser features. You need to code up the buttons & UI & for code you could do this -

-(IBAction)goForward:(id)sender
{
    [webView goForward];
}

-(IBAction)goBack:(id)sender
{
    [webView goBack];
}

-(IBAction) gotoHome:(id)sender
{
    NSString *urlAddress = @"http://google.com";
    NSURL *url = [NSURL URLWithString:urlAddress];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [webView loadRequest:requestObj];
}

Upvotes: 3

omz
omz

Reputation: 53551

SVWebViewController looks pretty much like what you're looking for.

Upvotes: 10

Related Questions