https://github.com/mozilla-mobile/firefox-ios-open-in-client
INACTIVE - http://mzl.la/ghe-archive - Reference client for opening links in Firefox for iOS.
https://github.com/mozilla-mobile/firefox-ios-open-in-client
inactive unmaintained
Last synced: 8 months ago
JSON representation
INACTIVE - http://mzl.la/ghe-archive - Reference client for opening links in Firefox for iOS.
- Host: GitHub
- URL: https://github.com/mozilla-mobile/firefox-ios-open-in-client
- Owner: mozilla-mobile
- License: mpl-2.0
- Archived: true
- Created: 2015-07-07T18:54:21.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2019-03-30T16:15:25.000Z (about 7 years ago)
- Last Synced: 2025-02-20T10:11:21.249Z (over 1 year ago)
- Topics: inactive, unmaintained
- Language: Swift
- Homepage:
- Size: 60.5 KB
- Stars: 43
- Watchers: 29
- Forks: 17
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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 installed
* `openInFirefox`: 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 ###
1. Download the class file in the language of your choice:
* Swift: [OpenInFirefoxControllerSwift.swift](https://github.com/mozilla/firefox-ios-open-in-client/blob/master/OpenInFirefoxClient/OpenInFirefoxControllerSwift.swift)
* Objective-C: [OpenInFirefoxControllerObjC.m](https://github.com/mozilla/firefox-ios-open-in-client/blob/master/OpenInFirefoxClient/OpenInFirefoxControllerObjC.m), [OpenInFirefoxControllerObjC.h](https://github.com/mozilla/firefox-ios-open-in-client/blob/master/OpenInFirefoxClient/OpenInFirefoxControllerObjC.h)
2. Whitelist the Firefox URL scheme in Info.plist, under the LSApplicationQueriesSchemes key:
* In depth example on how to do that [here](http://useyourloaf.com/blog/querying-url-schemes-with-canopenurl.html)
* If LSApplicationQueriesSchemes isn't already in your app's Info.plist, you can just manually add it
* Add `firefox` to LSApplicationQueriesSchemes
3. Call methods to open links in Firefox:
* [Example in Swift](https://github.com/mozilla/firefox-ios-open-in-client/blob/master/OpenInFirefoxClient/ViewController.swift#L38-41)
### Contribute to Firefox for iOS ###
Learn more about how to contribute to this project: [Firefox for iOS official repo](https://github.com/mozilla/firefox-ios)