Skip to content

bambooCZ/mac-default-browser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MacDefaultBrowser

I am not a Obj-C++ guy, feel free to improve this

Node module for interaction with macOS default browser (aka handler for "http", "https" schemes).

Building

cd MacDefaultBrowser ;
sudo npm install -g nw-gyp ;
nw-gyp configure --target=0.21.4 --arch=x64 ;
nw-gyp build --target=0.21.4;

Result will be in build/Release directory

Usage example

const MY_APP_ID = "com.mycompany.myapp";

var MacDefaultBrowser = require('./build/Release/MacDefaultBrowser.node');

var currentDefaultBrowser = MacDefaultBrowser.getDefaultBrowser();
if (currentDefaultBrowser != MY_APP_ID) {
    MacDefaultBrowser.setDefaultBrowser(MY_APP_ID);
}

JavaScript API

MacDefaultBrowser.getDefaultBrowser()

  • Return value {String} - application ID of system's default browser

This method will get application ID of system's default browser

MacDefaultBrowser.setDefaultBrowser(appId)

  • Parameter {String} appId - Application ID of default browser
  • Return value {bool} - Success? (Actually user can deny the request...)

This method will set system's default browser

About

node module for interaction with mac-default-browser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published