GeckoFX ObjectForScripting,GeckoFX 下js調用c#方法
后台注冊:
var subtitleWebBrowser = new GeckoWebBrowser(); subtitleWebBrowser.AddMessageEventListener("callMe", CallMe);
private void CallMe(string message) { }
GeckoFX內打開的HTML頁面:
<script type='text/javascript'> window.onload= function() { var event = document.createEvent('MessageEvent'); var origin = window.location.protocol + '//' + window.location.host; event.initMessageEvent ('callMe', true, true, 'some data', origin, 1234, window, null); document.dispatchEvent (event); } </script>