refactor of browser html parse logic to better handle iframes