I would like to create a custom event in JavaScript.
I have a WPF application with a WebBrowser inside, and a HTML page with JavaScript.
I work with a printe
Ok I found a solution.
I had to change the WebBrowser IE Version to Internet Explorer 11: http://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version
And then :
function OnPrinterStateChanged(state) {
var evt = document.createEvent("Event");
evt.state = state;
evt.initEvent("printerstatechanged", true, false);
window.dispatchEvent(evt);
}
window.addEventListener('printerstatechanged', function (e) {
// Do something
});