Get User-Agent for LINQPad browser in LPRun
Options
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
-
Under LPRun, there is no browser, and no engine to evaluate JavaScript.
-
Yes, it is expected. Maybe, there is another way except hardcoding it?