Jeśli okno jest niezdefiniowane

if (typeof window !== 'undefined') 
Faithful Fox