arboleya / electrify

Package your Meteor apps with Electron, and butter
MIT License
247 stars 52 forks source link

opening links in default browser? #5

Closed mashaal closed 9 years ago

mashaal commented 9 years ago

Thanks for this package- I'm trying to open links defined in my app in the user's default browser. I found this electron documentation, but unsure if it's possible call from meteor side?

https://github.com/atom/electron/blob/master/docs/api/shell.md

mashaal commented 9 years ago

nm- I found a solution using https://www.npmjs.com/package/open

arboleya commented 9 years ago

Hi, just out of curiosity, your need was opening the url from the client or server side of your meteor app?

And how you ended up doing, with this package you found?

mashaal commented 9 years ago

I have a link-sharing feature in my app, and wanted to open in browser (using target=blank opens in a new electron instance). I found that adding the NPM package (https://github.com/meteorhacks/npm), along with the Open package (linked above), that I can create a meteor method on the server that will then open in the default browser.

open = Meteor.npmRequire('open')

Meteor.methods 'link': (url) ->
  open(url)
  return
arboleya commented 9 years ago

Oh I see, very nice.

Tks for the infos.

cosmin-novac commented 8 years ago

Loading the entire npm package AND another package just to open a link seems awfully inefficient. Surely there must be a simpler way.