On windows, when the "Shell.Explorer" ActiveX control is embedded in an application it is possible to register an "external" handler - on object that implements IDispatch, such that scripts on the web page can call out to the hosting application.
<button onclick="window.external.Test('called from script code')">test</button>
Now, ive moved to Mac development and thought I could get something similar working from WebKit embedded in my Cocoa application. But, there really doesn't seem to be any facility to allow scripts to call back out to the hosting application.
One piece of advice was to hook window.alert
and get scripts to pass a formatted message string as the alert string.
Im also wondering if WebKit can perhaps be directed to an application hosted NPAPI plugin using NPPVpluginScriptableNPObject.
Am I missing something? Is it really this hard to host a WebView and allow scripts to interact with the host?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…