Fix frame switching after frame redirect/creation

This fixes #967 and also resolves #1001.

This has been tested initially on [this sandbox](http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe) and then on [r/videos](http://www.reddit.com/r/videos) (you may need RES enabled).
Is `total` still being used?