Set user agent before loadUrl

Refs #825