WebView.SetCustomUserAgent
--------------------------

Sets the custom user agent text.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [WebView](component_WebView.md) | [2.9](newinversion29.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |

MBS( "WebView.SetCustomUserAgent"; WebViewerRef; UserAgent ) 

**MBS**( **"WebView.SetCustomUserAgent";** /\* Sets the custom user agent text. \*/  
**$WebViewerRef**; /\* Either the Web Viewer Object Name or the Web Viewer ID as returned by "[WebView.FindByName](WebViewFindByName.md)" function.e.g. "web" \*/   
**$UserAgent**) /\* The new useragent.e.g. "FileMaker Browser" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| WebViewerRef | Either the Web Viewer Object Name or the Web Viewer ID as returned by "[WebView.FindByName](WebViewFindByName.md)" function. | "web" |
| UserAgent | The new useragent. | "FileMaker Browser" |

### Result

Returns OK or error.

### Description

Sets the custom user agent text.  
This user agent is reported to websites. By using a different user agent string you can tell a website that FileMaker is using Firefox, Chrome or Internet Explorer instead of Safari (WebKit).  
  
Add iOS with version 9.3.  
  
Implemented for Windows with Microsoft Edge/Chrome engine in MBS Plugin 11.5 when using FileMaker Pro 19.4 or newer.   
  
Please make sure the webviewer is already there. e.g. put in "about:blank" as URL in the layout editor. Then call WebView.SetCustomUserAgent in script to set th browser, before you load the final website.  
### Examples

Set custom user agent to be Internet Explorer 7:

 MBS ( "WebView.SetCustomUserAgent"; "web"; "Mozilla/4.0 (compatible; MSIE 7.0 ; Windows NT 6.0 )" )  
Set custom user agent to be Firefox 15:

 MBS ( "WebView.SetCustomUserAgent"; "web"; "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6 ; rv:15.0 ) Gecko/20100101 Firefox/15.0 .1" )  
Set custom user agent to be Safari 13.1:

 MBS ( "WebView.SetCustomUserAgent"; "web"; "Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_14\_6) AppleWebKit/605.1 .15 (KHTML, like Gecko) Version/13.1 Safari/605.1 .15" )  
Set custom user agent to be Chrom 83:

 MBS ( "WebView.SetCustomUserAgent"; "web"; "Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_14\_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0 .4103.61 Safari/537.36 " )  
### See also

- [WebView.FindByName](WebViewFindByName.md)
- [WebView.GetCustomUserAgent](WebViewGetCustomUserAgent.md)
- [WebView.PostURL](WebViewPostURL.md)

### Release notes

- **Version 9.3**
    - Added iOS support for [WebView.SetCustomUserAgent](http://www.mbsplugins.eu/WebViewSetCustomUserAgent.shtml) function.

### Example Databases

- [CURL/Email/GMail oAuth SMTP](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/GMail%20oAuth%20SMTP.shtml#1ScriptAnchor_)
- [CURL/Email/Office 365 oAuth SMTP](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/Office%20365%20oAuth%20SMTP.shtml#1ScriptAnchor_)
- [WebViewer/Custom User Agent](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WebViewer/Custom%20User%20Agent.shtml#1GroupButton24.0000000402.000000049.0000000547.0000000LayoutObjectAnchor_)

### Blog Entries

- [Using Gmail with oAuth2 for SMTP with MBS Plugin](https://www.mbsplugins.de/archive/2025-05-08/Using_Gmail_with_oAuth2_for_SM/monkeybreadsoftware_blog_filemaker)
- [SMTP with OAuth for Office 365 in FileMaker](https://www.mbsplugins.de/archive/2022-11-22/SMTP_with_OAuth_for_Office_365/monkeybreadsoftware_blog_filemaker)
- [WebPreferences for WebView2](https://www.mbsplugins.de/archive/2021-11-05/WebPreferences_for_WebView2/monkeybreadsoftware_blog_filemaker)
- [Neues MBS FileMaker Plugin 9.3 - Über 5900 Funktionen in einem Plugin](https://www.mbsplugins.de/archive/2019-07-24/Neues_MBS_FileMaker_Plugin_93_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 9.3 - More than 5900 Functions In One Plugin](https://www.mbsplugins.de/archive/2019-07-24/MBS_FileMaker_Plugin_93_-_More/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 9.3pr6](https://www.mbsplugins.de/archive/2019-07-17/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 2.9pr7](https://www.mbsplugins.de/archive/2012-09-11/MBS_Filemaker_Plugin_version_2/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 2/2024, Seite 16](https://filemaker-magazin.de/neuigkeit/4257-Appetithappen-FMM_202402)

This function checks for a license.

Created 18th August 2014 , last changed 21st March 2023

  
[WebView.SetAutoResizingMask](WebViewSetAutoResizingMask.md) - [WebView.SetDrawsBackground](WebViewSetDrawsBackground.md)

[HTML Version](WebViewSetCustomUserAgent.shtml)