Check if we are in the browser before requiring request animation frame.