Beginnings of iframe handling and navigation bug fix

Fixes #579.