GithubHelp home page GithubHelp logo

isabella232 / ios-open-thirdparty-browser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brave/ios-open-thirdparty-browser

0.0 0.0 0.0 83 KB

Reference client for opening links in Firefox and Brave iOS

License: Mozilla Public License 2.0

Objective-C 39.06% Swift 60.94%

ios-open-thirdparty-browser's Introduction

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

  • isInstalled: returns true if installed
  • openInBrowser: opens the specified URL; used with or without the following:

The Custom URL

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

  • url: (required) the URL to open.

For Example:

firefox://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:
  • Swift: OpenInThirdPartyBrowserControllerSwift.swift
  • Objective-C: OpenInThirdPartyBrowserControllerObjC.m and OpenInThirdPartyBrowserControllerSwiftObjC.h
  1. Whitelist the Firefox and Brave URL scheme in Info.plist, under the LSApplicationQueriesSchemes key:
  • Add firefox and brave to LSApplicationQueriesSchemes
  • If LSApplicationQueriesSchemes isn't already in your app's Info.plist, you can just manually add it
  • In depth example on how to do that here
  1. Call method openInBrowser(url) on OpenInThirdPartyBrowserController(Swift/ObjC)

ios-open-thirdparty-browser's People

Contributors

bkmunar avatar garvankeeley avatar rnewman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.