iOS: UIWebView full open source browser? - ios

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.

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

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.

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

Related

WKWebView openurl in another application

I'm using WKWebView to show YouTube in my application.
When I load a youtube page it's sometimes open the YouTube App in my iPhone device.
This is the code I'm using:
NSURLRequest * req = [NSURLRequest requestWithURL:[NSURL URLWithString:#"https://www.youtube.com/"]];
[self.loginWebView loadRequest:req];
There is an option to detect the popup and prevent it?
I did want to post this as a comment but low rep won't let me. So, You might want to look at this topic:
Disable WKWebView for opening links to redirect to apps installed on my iPhone

GreyBox when interacting with PowerBI Embedded Report (WKWebView)

I'm trying to embed Power BI report & dashboard in a custom mobile app. I'm using webview (WKWebView) because I see there is no API besides Javascript to display the report in my (iOS) mobile apps. The embedded report is running, but i found this grey box when I try to interact with it and the user find it a little bit disturbing. (
check out this video
).
I put the html file in the asset (xcode project) and then load it into a WebView.
#property (strong, nonatomic) IBOutlet WKWebView *dashboardWV;
NSString *filePath=[[NSBundle mainBundle]pathForResource:#"BI" ofType:#"html" inDirectory:#"powerbi"];
NSURL *url = [NSURL fileURLWithPath: filePath];
NSURLRequest* request = [NSURLRequest requestWithURL:url];
[dashboardWV loadRequest:request];
Is there another way to embed the report to my mobile apps without webview / to get the same user experience with the PowerBI Mobile apps?
I see that the PowerBI Mobile App (unlike mine) run smoothly in the iPad without the Grey Boxes.
This is a known issue, we are working on fixing it (no ETA yet).

UIWebView not playing embedded stream mp4 video

I am trying to play a video from a website that I load inside my UIWebView in an iOS application developed with Objective C language.
When I hit the play button, I get an error message :
The video cannot be loaded, either because the server or network failed or because the format is not supported.
The code I've written for the web view is quite simple :
NSURL *url = [NSURL URLWithString:webSite];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webBrowser loadRequest:request];
The thing is that the same video is loading fine on Safari from the same device (iPad ).
Thanks!
(1) The video is not a web site. You might need to wrap it to a web page.
(2) If the video URL is not „https://„ it will fail playing since ios9 (?). You need to enable „Arbitrary Loads“ in your App‘s Info.plist.
Advice: Check option 2 first.

Opening a pdf file from my iOS App with a specific external application

I am developing an iPad application which is capable of downloading different types of files from web. I want to give user's, option to open downloaded files (those my application cant handle) to other applications installed in the device.
I know this can be done by using UIDocumentInteractionController, but i want to skip the show options in this method.
For example: After downloading a pdf file from web, on tapping a button "Open", it should automatically open to adobe reader application in the device.
CustomURL is a useful method to launch a specific application, but it may be difficult to get URL schemes of some applications.
Please share your thoughts.
Thanks in advance.
You need to do a method and call either from web option or local (do you want this?)option.
From web directly:
UIWebView *theWebView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 10, 200, 200)];
NSURL *targetURL = [NSURL URLWithString:#"http://yoursiteweb/directory/file.pdf"];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[theWebView loadRequest:request];
[self.view addSubview:theWebView];
From your bundle after you I downladed the file:
UIWebView *theWebView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 10, 200, 200)];
NSString *path = [[NSBundle mainBundle] pathForResource:#"file" ofType:#"pdf"];
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[theWebView loadRequest:request];
[self.view addSubview:theWebView];
For example: After downloading a pdf file from web, on tapping a
button "Open", it should automatically open to adobe reader
application in the device.
You want to open another app. If you don't know its URL schema, how could you open it? Through URL schema is the only way we can use to launch another app in one app. Apple does not provide a way to get the list of app that can open the file. So you need to know the exact URL schema for every app you want to open. Indeed a little frustrating.

Web view is not loading for particular url

I am trying to load webview for the following url http://www.topchickw.com/ but blank screen occured but same code is working for other url's
NSURL *myUrl = [NSURL URLWithString:#"http://www.topchickw.com/"];
NSURLRequest *myUrlRequest = [NSURLRequest requestWithURL:myUrl];
[self.myWebView loadRequest:myUrlRequest];
Can any one suggest me how to load webview of the particular url
Thanks in Advance
I am not an HTML expert. It seems that the URL when loaded is playing a flash video (.swf file). iOS does not support flash. Hence the blank screen.
To cross check this I try opening the URL in mobile safari browser, it did not work.
Hope that helps!
Well this url if you open manually in browser you will get blank window only. Please check the issue is not in the code.
A flash file runs when this url is loaded into browser. The issue is not with code but with the website as iOS doesnot support flash.

Resources