Optimal handling of browser window resize