How to access navigator.userAgent?

Seems that adding custom router just to pass through user agent, oh god how ugly it is.