Sorry I was sleeping when you ask in the FireBreath chat room. A slightly more abbreviated method would be:
FB::DOM::DocumentPtr dom = m_host->getDOMDocument();
try {
if (dom && dom->getJSObject()->HasProperty("title")) {
std::string title = m_host->getDOMDocument()->getProperty<std::string>("title");
}
} catch (...) {
// Could not get the title
}
You should always wrap a convert_cast in a try .. catch in case the convert fails. The getProperty abstraction on the DOM::Document object here basically is just doing a convert_cast internally.