Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue 934: added URL scheme support for MAC. #1769

Merged
merged 2 commits into from
Jan 21, 2015

Conversation

dougtedd
Copy link

@dougtedd dougtedd commented Apr 8, 2014

No description provided.

@dougtedd dougtedd mentioned this pull request Apr 8, 2014
@gpetrov
Copy link

gpetrov commented Aug 1, 2014

@rogerwang Please merge this - it is very useful for custom URL schemes that work already on all platforms but MAC and this pull request fixes it.

@flippyhead
Copy link

👍 here here!

@TimotheeJeannin
Copy link

Will this be merged soon ? I can't release the Mac version of my application because of this ...

@gpetrov
Copy link

gpetrov commented Dec 1, 2014

@dougtedd could you please update to the latest base? So @rogerwang can merge easily

@spoorun
Copy link

spoorun commented Dec 4, 2014

@gpetrov Reading your earlier comment, does that mean that there is already some URL scheme support for WIndows and Linux systems within node-webkit?

("Please merge this - it is very useful for custom URL schemes that work already on all platforms but MAC and this pull request fixes it.")

Conflicts:
	src/browser/app_controller_mac.mm
@dougtedd
Copy link
Author

dougtedd commented Dec 9, 2014

The merge of rogerwang/node-webkit master has been performed. The result is in https://github.com/ribrain/node-webkit

@tommoor
Copy link

tommoor commented Jan 18, 2015

@dougtedd does this allow deep linking? or reading the url from within the app at all?

@dougtedd
Copy link
Author

@tommoor This fix should enable you to get access to the URL that the application was invoked through. E.g. if your app is bound to the protocol myapp and you open a link 'myapp://one.two' then the URL 'myapp://one.two' should be available in your node webkit app. This URL can be either accessed through the arguments passed to the app (gui.App.argv) or by adding an open listener, e.g.:
gui.App.on('open', function(file) { console.log("Open url: " + file); });
If you need deep linking then you would need to add support for this yourself in the application code.

@tommoor
Copy link

tommoor commented Jan 21, 2015

perfect, sounds great. @rogerwang is there anything specific preventing a merge of this functionality?

rogerwang added a commit that referenced this pull request Jan 21, 2015
Fix for issue 934: added URL scheme support for MAC.
@rogerwang rogerwang merged commit 4c1d34e into nwjs:master Jan 21, 2015
@rogerwang
Copy link
Member

Thanks. I thought this implementation is platform specific.

@ekhaled
Copy link

ekhaled commented Mar 12, 2015

@dougtedd @rogerwang
This feature seems to have been removed from v0.12.0

Can this be added back please, we can't update to the latest version because of this.
I'm no C# expert, but I did a quick diff of the files, and all code introduced by this merge seems to have been removed in the latest version.

Please help...

@shawnjung
Copy link

I really need this feature :'(

@ypt
Copy link

ypt commented Jun 23, 2015

We would also love it if @dougtedd's fix in 4c1d34e was added back in - so that in OSX we're able to access the URL that the application was invoked through. (This seems to already be working in Windows).

@gpetrov
Copy link

gpetrov commented Jun 23, 2015

@rogerwang - Could you please check this and put it back in nw13? We really would like to finally be able to register custom Data Schemes on the Mac as well

achwedyk pushed a commit to achwedyk/nw.js that referenced this pull request Aug 6, 2015
@jaruba
Copy link

jaruba commented Aug 12, 2015

It's crazy that this has been removed, bring it back!

@rogerwang
Copy link
Member

Will fix this. Thanks for your patience.

@rogerwang
Copy link
Member

Merged to v0.12 as 98b1ef8 . Will port to v0.13 as well.

@jaruba
Copy link

jaruba commented Aug 13, 2015

@rogerwang Thanks! It should be noted that @achwedyk mentioned that he also needed to make this change: achwedyk@6f3ba7c to this PR in order for it to work on NW.js v0.12.x

Original Comment

@chennney
Copy link

Will 0.12.4 be released soon with this fix?

@gpetrov
Copy link

gpetrov commented Dec 18, 2015

@rogerwang this still not in 0.13 - please merge it, it is a small code fix but very useful

@cuongleqq
Copy link

Any news on this feature for 0.12.4 or 0.13? We are waiting for this feature to launch our app.

@gpetrov
Copy link

gpetrov commented Jan 14, 2016

@rogerwang Please merge this in 0.13 - we are depending on it as well!
It is just the 98b1ef8 + achwedyk@6f3ba7c

then we will finally be able to switch to 0.13!

This fix is only needed for the mac - on Windows it is all ok!

@rogerwang
Copy link
Member

I'll rework this patch since the architecture is changed in this version. Hopefully it will be released with beta.

@gpetrov
Copy link

gpetrov commented Jan 14, 2016

Thanks @rogerwang looking forward to it!

@rogerwang
Copy link
Member

@gpetrov could you please provide a sample app and steps so I can test it?

@gpetrov
Copy link

gpetrov commented Jan 15, 2016

@rogerwang you can test it very easy on any nwjs app, just follow the following few steps.
Here I will register the protocol test333://

  • if you show the Contents of the app, under Contents, edit Info.plist
  • in the beginning just after the dict tag add:
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLName</key>
            <string>Test Extension</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>test333</string>
            </array>
        </dict>
    </array>    
  • in your index,html or main file under app.nw, add something like:
var Gui = require('nw.gui');
Gui.App.on('open', function(url) {
    console.log('APP OPEN EVENT! cmd: ', url);
});
  • open you app once and close it (protocol gets registered from the Info.plist)
  • open safari and enter a url with the registered protocol like this:
    test333://somecustom_string
  • if everything is OK you app should be opened and the open event should be triggered with the url parameter to it
  • if you app was already open it should be activated and only the open event fired again with the passed url

On Windows the registration process is different but it results on the same of the app being started/or activated if running and the open event fired with the url.
You can see the Windows registration process here: http://stackoverflow.com/questions/389204/how-do-i-create-my-own-url-protocol-e-g-so

@gpetrov
Copy link

gpetrov commented Feb 1, 2016

any progress @rogerwang ? I thought you will get it in the next beta ...
Hope to see it soon! Was my test good enough?

@hthetiot
Copy link

hthetiot commented Sep 6, 2016

+1

@rogerwang
Copy link
Member

@hthetiot this was fixed in #4240 and was released with 0.13.0-beta6: http://nwjs.io/blog/v0.13.0-beta6/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.