I need to check if a WebBrowser control in my Windows Phone app has a history, and the way that I figured out how to do that is by using browser.InvokeScript(\"eval\",
hasHistory = (bool)browser.InvokeScript("eval", "return (history.length > 0);");
The method InvokeScript returns an object that is the object returned by the script you executed.
The following code is a bit hackish, but seems to work fine for most cases.
bool hasHistory = false;
try
{
webBrowser1.InvokeScript("eval");
hasHistory = true;
}
catch (SystemException ex)
{
hasHistory = false;
}