Quick Tip: Node.js Open URL in User’s Preferred Application/Browser

Using the node-open module you can open files or URLs in the user’s preferred application.

For example this piece code will open CSSDeck in the user’s default browser (for me it’s Google Chrome) –

What's the one thing every developer wants? More screens! Enhance your coding experience with an external monitor to increase screen real estate.

var open = require('open');
open('http://cssdeck.com');

You can also open mailto URLs in the browser or the email client (depending upon user’s preferences) –

var open = require('open');
open('mailto:[email protected]');

The module handles cross-platform issues pretty well!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Author: Rishabh

Rishabh is a full stack web and mobile developer from India. Follow me on Twitter.

Leave a Reply

Your email address will not be published. Required fields are marked *