1. 程式人生 > >GeckoFX ObjectForScripting,GeckoFX 下js調用c#方法

GeckoFX ObjectForScripting,GeckoFX 下js調用c#方法

html some null ctf patch ava script isp browser

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>

GeckoFX ObjectForScripting,GeckoFX 下js調用c#方法