brave/ios-open-thirdparty-browser

Name: ios-open-thirdparty-browser

Owner: Brave Software

Description: Reference client for opening links in Firefox and Brave iOS

Forked from: mozilla-mobile/firefox-ios-open-in-client

Created: 2016-04-22 15:31:18.0

Updated: 2017-11-19 15:03:38.0

Pushed: 2016-04-22 17:26:49.0

Homepage:

Size: 76

Language: Swift

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Opening links in Firefox and Brave for iOS

This open-source project provides support for opening links in third party browsers for iOS. There are classes (for Objective-C and Swift), along with a sample project that uses them, available for reference and use.

Using OpenInThirdPartyBrowserControllerSwift or OpenInThirdPartyBrowserControllerObjC to open links

Thes classes provide methods that handle the making of custom URI schemes, checking if Firefox or Brave (or others if we want to add more) is installed on the device and opening the URL in the browser. Swift and Objective-C implementations of these classes are provided to accommodate your language of choice.

Methods
The Custom URL

The URI schemes are firefox:// and brave://. The scheme accepts the following query parameter:

For Example:

fox://open-url?url=https%253A%252F%252Fwww.mozilla.org%252Fen-US%252Fnewsletter%252Fios%252F
Walkthrough
  1. Download the class file in the language of your choice:
  2. Swift: OpenInThirdPartyBrowserControllerSwift.swift
  3. Objective-C: OpenInThirdPartyBrowserControllerObjC.m and OpenInThirdPartyBrowserControllerSwiftObjC.h
  4. Whitelist the Firefox and Brave URL scheme in Info.plist, under the LSApplicationQueriesSchemes key:
  5. Add firefox and brave to LSApplicationQueriesSchemes
  6. If LSApplicationQueriesSchemes isn't already in your app's Info.plist, you can just manually add it
  7. In depth example on how to do that here
  8. Call method openInBrowser(url) on OpenInThirdPartyBrowserController(Swift/ObjC)

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.