I need the user to be able to click a button (in the web content), browse for a file on Windows, and then have the javascript code on the page be able to access the path of the selected file.
In a normal browser, I can't do that as the browser only reveals the file name but not the whole path.
I'm new to CEF and this would be my first attempt to do anything other than just show the html/js content. I'm looking through documentation but a little overwhelmed, and I would appreciate any pointers in the right direction to go to achieve that.
I see a couple of leads for me to explore:
1) In the Xilium.CefGlue documentation there
CefDialogHandler.OnFileDialog which sounds like what I want — "Called to run a file chooser dialog".
- How do I initiate this file dialog, i.e. call the callback? I thought maybe HTML5 <input type="file"> tag, but I didn't see that calling back in my first attempt
- Can I get OnFileDIalog to do what I need, that is initiated from the web content rather than from the client app code?
2) If that doesn't work, I'm seeing that there's ways in CEF to inject my own javascript function (
CefV8Value.CreateFunction) that will call back into my client app. Seems like it might be an option.
3) Is there an easier way to support the user browsing for a file? I figure that is a common enough task that it shouldn't be very complicated...
Thanks for your assistance to this CEF newbie.