Check for the presence of navigator before trying to access it. Fixes
#38