Open link in new tab and switch to it

This attempts to resolve #900 and also fixes #1035 (a related issue).