if (typeof window !== 'undefined') { // You now have access to `window` }
if (typeof window !== 'undefined') { // Boom }