Protocol Handler in CEF

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Protocol Handler in CEF

Postby rasesh1 » Fri Mar 09, 2018 9:41 am

Currently, CEF enables file, ws, was, http, https schemes by default, how can I launch another application by registering another protocol handler ? Is setting allow_os_execution = true is the way to go
rasesh1
Newbie
 
Posts: 5
Joined: Fri Mar 09, 2018 7:54 am

Re: Protocol Handler in CEF

Postby magreenblatt » Fri Mar 09, 2018 12:34 pm

You can launch the external application yourself in OnProtocolExecution or use allow_os_execution if it supports the protocol that you're interested in.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Protocol Handler in CEF

Postby rasesh1 » Sun Mar 11, 2018 10:18 am

I created a sample app to test the functionality in Mac. The app is supposed to launch on invoking testApp:// protocol. I found that the app launches from Safari, Firefox. But not through Chrome on invoking testApp://.

I also found that the app launches from an older version of cef, but not through latest version. Is that some bug or am I missing anything ?

I have implemented OnProtocolExecution and made allow_os_execution = true
rasesh1
Newbie
 
Posts: 5
Joined: Fri Mar 09, 2018 7:54 am

Re: Protocol Handler in CEF

Postby magreenblatt » Sun Mar 11, 2018 3:59 pm

OnProtocolExecution is called when you click a testApp:// link inside CEF. Not when you click a testApp:// link in some other application. Issues launching your CEF-based app from some other application are unlikely to be CEF-related.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Protocol Handler in CEF

Postby rasesh1 » Mon Mar 12, 2018 4:35 pm

I think I confused you. Sorry for that. Actually, I am working on a Mac. I created a CEF-based app and from that CEF-based app (CEF 3163), I want to launch an external application using custom protocol.

I implemented OnProtocolExecution and assigned allow_os_execution = true. Still, I can't get the app to launch in Mac. For curiosity, I tested in Windows and it worked there.

On analysing the CEF code, it was seen that the function " CefBrowserPlatformDelegateNativeMac::HandleExternalProtocol " present in browser_platform_delegate_native_mac.mm is empty, which is probably why it isn't working.

I again tested in CEF 2272 in Mac. It worked there. Will there be any implementation of HandleExternalProtocol for Mac in future ?

For now, I think launching using system calls is probably the best way.
rasesh1
Newbie
 
Posts: 5
Joined: Fri Mar 09, 2018 7:54 am

Re: Protocol Handler in CEF

Postby magreenblatt » Mon Mar 12, 2018 4:43 pm

magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Protocol Handler in CEF

Postby rasesh1 » Thu Mar 15, 2018 7:44 am

I got the fix. Putting here for record. The best way I found to launch an external application is to use the following in OnProtocolExecution for Mac:

Code: Select all
string urlStr = url;
NSString* URL = [NSString stringWithUTF8String:urlStr.c_str()];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:URL]];
rasesh1
Newbie
 
Posts: 5
Joined: Fri Mar 09, 2018 7:54 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 92 guests