{"id":18271001,"url":"https://github.com/nbuggia/Browser-View-Controller--iPhone-","last_synced_at":"2025-04-05T01:30:58.960Z","repository":{"id":67824914,"uuid":"2662464","full_name":"nbuggia/Browser-View-Controller--iPhone-","owner":"nbuggia","description":"Boilerplate code to embed a Browser into your iPhone app","archived":false,"fork":false,"pushed_at":"2016-12-25T00:25:29.000Z","size":180,"stargazers_count":95,"open_issues_count":1,"forks_count":26,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-05T11:53:17.480Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://nathanbuggia.com/posts/browser-view-controller/","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nbuggia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-10-28T01:33:58.000Z","updated_at":"2024-08-02T02:18:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"a60a47ad-a391-44da-b5b7-080868041847","html_url":"https://github.com/nbuggia/Browser-View-Controller--iPhone-","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbuggia%2FBrowser-View-Controller--iPhone-","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbuggia%2FBrowser-View-Controller--iPhone-/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbuggia%2FBrowser-View-Controller--iPhone-/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbuggia%2FBrowser-View-Controller--iPhone-/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nbuggia","download_url":"https://codeload.github.com/nbuggia/Browser-View-Controller--iPhone-/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276043,"owners_count":20912286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T11:39:00.821Z","updated_at":"2025-04-05T01:30:58.951Z","avatar_url":"https://github.com/nbuggia.png","language":"Objective-C","funding_links":[],"categories":["etc"],"sub_categories":[],"readme":"#Browser View Controller\n##OVERVIEW\nThe BrowserViewController is a boilerplate class that handles opening a web page from within your application. This allows you to create a smooth experience within your app for loading web content and then seamlessly getting back into you app.\n\nThe icons were generously contributed by [Joseph Wain](\"http://penandthink.com/\") of [Glyphish](\"http://glyphish.com\") for this project.\n\n![Screenshot 1](http://nathanbuggia.com/wp-content/uploads/2011/10/Browser-View-Controller-1.png)![Screenshot 2](http://nathanbuggia.com/wp-content/uploads/2011/10/Browser-View-Controller.png)\n\n##QUICK START GUIDE\nThis boiler plate code support these 3 common scenarios:\n###UIButton or UITableView\n1. Copy all the files in the \"Browser View Controller Boilerplate\" folder into your xcode project. (If you never want to use a `UITextView` or `UIWebView` than you do not need `MyApplication.h` or `MyApplication.m`)\n\n2. Reference the Browser View Controller header file in the ViewController you want to open the URL from.\n\n        #import \"BrowserViewController.h\"`\n\n3. Now you can open the Browser View Controller with your own code. Here's a sample method to do it:\n\n        - (void)openURL:(NSURL)url\n        {\n             BrowserViewController bvc = [[BrowserViewController alloc] initWithUrls:url];\n             [self.navigationController pushViewController:bvc animated:YES];\n             [bvc release];\n        }\n\n###UITextView\n4. Update the parameters of your UIApplication to specify a subclass. This subclass will allow you to trap requests to open URLs in Safari, and open them from within your app instead. Make sure you have copied `MyApplication.h` and `MyApplication.m`, they contain the code that overrides the openURL method.\n\n        int retVal = UIApplicationMain(argc, argv, @\"MyApplication\", nil);\n\n5. Override the (BOOL)openURL method in your AppDelegate class, and add a corresponding stub in your AppDelegate class header.\n\n        -(BOOL)openURL:(NSURL)url\n        {\n            BrowserViewController bvc = [[BrowserViewController alloc] initWithUrls:url];\n            [self.navigationController pushViewController:bvc animated:YES];\n            [bvc release];\n        }\n\n6. Update `MyApplication.m` with the name of your AppDelegate class to reference the method you added in the last step.\n\n        couldWeOpenUrl = [(YOUR_APP_DELEGATE_CLASS_NAME)self.delegate openURL:url];\n\n###UIWebView\n7. Implement the 'UIWebView' delegate in the View Controller containing your 'UIWebView'. Override the 'shouldStartLoadWithRequest' forcing it to open the link in your App\n\n        -(BOOL) webView:(UIWebView )inWeb shouldStartLoadWithRequest:(NSURLRequest )inRequest \n        navigationType:(UIWebViewNavigationType)inType \n        {\n            if ( inType == UIWebViewNavigationTypeLinkClicked ) \n            {\n                [[UIApplication sharedApplication] openURL:[inRequest URL]];\n                return NO;\n            }\n            return YES;\n        }\n\n##LICENSE\nThis software is licensed under the MIT Software License\n\nCopyright (c) 2011 Nathan Buggia\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnbuggia%2FBrowser-View-Controller--iPhone-","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnbuggia%2FBrowser-View-Controller--iPhone-","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnbuggia%2FBrowser-View-Controller--iPhone-/lists"}