firefox-ios-open-in-client
firefox-ios-open-in-client copied to clipboard
Reference client for opening links in Firefox for iOS.
Opening links in Firefox for iOS
This open-source project provides support for opening links in Firefox for iOS. There are classes (for Objective-C and Swift), along with a sample project that uses them, available for reference and use.
Using OpenInFirefoxControllerSwift or OpenInFirefoxControllerObjC to open links
The OpenInFirefoxControllerSwift and OpenInFirefoxControllerObjC classes provide methods that handle the making of custom URI schemes, checking if Firefox is installed on the device and opening the URL in Firefox. We have provided Swift and Objective-C implementations of these classes to accommodate your language of choice.
Methods
isFirefoxInstalled: returns true if Firefox is installedopenInFirefox: opens the specified URL in Firefox; used with or without the following:
The Custom Firefox URL
Firefox uses a single URI scheme, firefox://. This scheme can accepts the following query parameter:
url: (required) the URL to open in Firefox.
For Example:
firefox://open-url?url=https://www.google.com/search%3Fq%3Dfirefox%2520for%2520ios
Walkthrough
- Download the class file in the language of your choice:
- Swift: OpenInFirefoxControllerSwift.swift
- Objective-C: OpenInFirefoxControllerObjC.m, OpenInFirefoxControllerObjC.h
- Whitelist the Firefox URL scheme in Info.plist, under the LSApplicationQueriesSchemes key:
- In depth example on how to do that here
- If LSApplicationQueriesSchemes isn't already in your app's Info.plist, you can just manually add it
- Add
firefoxto LSApplicationQueriesSchemes
- Call methods to open links in Firefox:
Contribute to Firefox for iOS
Learn more about how to contribute to this project: Firefox for iOS official repo