https://github.com/jperelli/cordova-plugin-register-filetype
Register a filetype to be opened with your app when tapping on a file
https://github.com/jperelli/cordova-plugin-register-filetype
cordova cordova-ios cordova-plugin ionic ionic-plugin phonegap phonegap-plugin plugin
Last synced: 2 months ago
JSON representation
Register a filetype to be opened with your app when tapping on a file
- Host: GitHub
- URL: https://github.com/jperelli/cordova-plugin-register-filetype
- Owner: jperelli
- License: gpl-3.0
- Created: 2017-02-06T21:12:52.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-08T17:09:14.000Z (over 9 years ago)
- Last Synced: 2025-06-09T17:02:35.244Z (about 1 year ago)
- Topics: cordova, cordova-ios, cordova-plugin, ionic, ionic-plugin, phonegap, phonegap-plugin, plugin
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cordova-plugin-register-filetype
Register a filetype to be opened with your app when clicking on the file.
Plugin only working for iOS right now. This is extremely useful for iOS apps because they cannot open files outside their sandbox.
## Installation
cordova plugin add https://github.com/jperelli/cordova-plugin-register-filetype.git --variable EXTENSION= --variable MIMETYPE=application/x-my-mimetype
## Usage
Define a window.handleOpenURL(url) function to react to the file opening. This function will be called when your app is opened from a file being open.
// insert this script in index.html
function handleOpenURL(url) {
// url will be something like "file:///path/to/file.extension"
console.log(url);
setTimeout(function() {
// use timeout to avoid problems when using other plugins here (workaround for a cordova issue, see https://github.com/EddyVerbruggen/Custom-URL-scheme/issues/93)
// you can read the file here using the cordova-plugin-file
}, 0);
}
## Future plans
We are working to
- Add android support
- Remove the need of setTimeout workaround
- Upload the plugin to npm
## Contributors
- Julian Perelli
- Mauricio Pérsico
## License
GNU GPL v3