Is it possible to set custom useragent in webview?


Hi All,

Is there a way to set custom useragent for webview ?
If so can someone please guide me how to set it.

Thanks in advance.


You could try the nativescript-webview-utils plugin to add a custom header. Here’s some sample code:


Thank you Eddy for your response.
I did override the “User-Agent” header but some how it is still taking the default User-Agent of android web view.
I have added some new custom headers and the header are setting successfully but i didn’t got success with the User-Agent header :pensive:.


Finally i was able to set custom User-Agent :grinning:.
Used following code to do so.“your-custom-user-agent”);


Any way to set user agent for iOS (instead of is there some equivalent for iOS?


Yes there is, and you can now use this plugin function to do so:


Thanks so much for making that @Eddy! works great.