简体   繁体   中英

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?

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

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.

在此处输入图像描述

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

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];
}

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM