Only use the history API in diagnostic console if it exists

Fixes #687