Home

Get User-Agent for LINQPad browser in LPRun

Is there a way to get User-Agent for LINQPad browser when running script in LPRun (I need it for HttpClient and do not want to hardcode it)? The following works in LINQPad and returns null in LPRun.

Util.InvokeScript(true, "eval", "navigator.userAgent")
// LINQPad: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0
// LPRun: null

Comments

Sign In or Register to comment.