-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Implement URL scheme support for MAC in 0.13 #4240
Comments
Testing this it very easy on any nwjs app, just follow the following few steps.
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>Test Extension</string>
<key>CFBundleURLSchemes</key>
<array>
<string>test333</string>
</array>
</dict>
</array>
var Gui = require('nw.gui');
Gui.App.on('open', function(url) {
console.log('APP OPEN EVENT! cmd: ', 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. |
Fixed in git and will be available in the next nightly build. |
@rogerwang crash is fixed on beta6, but open event argument is
Am I missing something? |
@rogerwang I also don't see where this new function OSXOpenURLsHook is called ... |
@k7k0 Did you got the app open event on each invocation of the custom url? Even when the app is already active? So not only when started initially? |
@gpetrov I'm receiving the |
sorry, actually beta6 doesn't contain the full fix. will fix it again asap. @gpetrov the hook is called from here: https://github.com/nwjs/chromium.src/blob/nw13/chrome/browser/app_controller_mac.mm#L1384 |
Fixed again in git and will be available in the next nightly build. |
@rogerwang great, now is working alright!
Thanks! |
I am not getting the url on 'open' event. This is my sample start.html: and package.json: info.plist: The application gets registered with test333, but alert message never shows the url. I tried with 0.13.0 as well as latest nwjs version. |
@gpetrov Please guide me on how to get the URL. Does it take anything extra to do other than what is mentioned in your test333 example? |
@snehapshinde - all works fine from the example above, you just need to handle the open event, like this in the latest nwjs:
This will handle the event when user triggers the user protocol and your app is already open. If you want to handle the case when your app is not yet open, make sure you also check the command line arguments nw.App.argv for the same sort url as parameter when your app is fully initialized. |
Ok, thanks. I think I was doing something wrong. It is working fine! I have couple of questions:
Thanks for your reply. |
@gpetrov Kindly reply to my queries. Waiting for it. |
@snehapshinde this is not a support forum, please check the apple docs on implementing custom protocols |
Ok. Thanks. I will check. |
Please implement this in 0.13 - we are depending on this functionality, so that our app can be opened with custom url scheme - it was already on 0.12!
The code is just is just the 98b1ef8 + achwedyk/nw.js@6f3ba7c
This fix is only needed for the mac - on Windows it is all ok!
On 0.12 it was implemented with #1769
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: