typeof instead of if (window)