Hi,
This is not a crash. The root of the problem is the following code in the page:
Code: HTML/ASPX
<body onLoad="window.print(), setTimeout('self.close()',0)" ...>
The code closes the window immediately after the print has started. EO.WebBrowser honors self.close faithfully thus immediately close the tab after the print has started, which in turn immediately cancels the printing.
Chrome on the other hand has various built-in logics to ignore self.close call. For example, if you load the page directly into a tab, then self.close will be ignored. You can duplicate such logic in your code as well. There are several ways to ignore self.close:
1. Set WebView.JSInitCode to overwrite window.close. For example, you can do something like this:
Code: JavaScript
window.close = function(){};
2. Handle WebView.Closing event and set e.Cancel to true in your event handler;
Note that the above code only shows you how to disable closing the window. In real scenarios you will want to do this conditionally. For example, if you chose option 2, then you may still want the window to close if user choose to close the window by clicking the "X" button on the tab title. In that case you can do something like this (based on TabbedBrowser source code):
Code: C#
private bool m_bUserClose;
private void mainTabs_PreviewItemClose(object sender, TabItemCloseEventArgs e)
{
//Remember that this is user close
m_bUserClose = true;
.......
item.Page.WebView.Close(false);
}
private void WebView_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
//Only cancel closing if it is not from the user
if (!m_bUserClose)
e.Cancel = true;
}