WebView.Copy
------------

Copies current text selection to clipboard.

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

MBS( "WebView.Copy"; WebViewerRef ) 

**MBS**( **"WebView.Copy";** /\* Copies current text selection to clipboard. \*/  
**$WebViewerRef**) /\* Either the Web Viewer Object Name or the Web Viewer ID as returned by "[WebView.FindByName](WebViewFindByName.md)" function. \*/ 

### Parameters

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

### Result

Returns OK or error.

### Description

Copies current text selection to clipboard.  
This is like choosing the menu command to copy, but without using the menu.  
See also [Clipboard.GetStyledText](ClipboardGetStyledText.md).  
  
As WebViewer functions often run asynchronously, you need to make a short script pause to let the WebViewer do the job.  
### Examples

Select all and copy:

 MBS ( "[WebView.SelectAll](WebViewSelectAll.md)"; "web" ) &amp; MBS ( "Webview.Copy"; "web" )  
### See also

- [Clipboard.GetStyledText](ClipboardGetStyledText.md)
- [TextView.Copy](TextViewCopy.md)
- [WebView.Close](WebViewClose.md)
- [WebView.Cut](WebViewCut.md)
- [WebView.FindByName](WebViewFindByName.md)
- [WebView.SelectAll](WebViewSelectAll.md)

### Release notes

- **Version 11.3**
    - Fixed [WebView.CopyFormattedText](https://www.mbsplugins.eu/WebViewCopyFormattedText.shtml) for Windows to return OK on success.
- **Version 8.2**
    - Implemented [WebView.GetFormattedText](http://www.mbsplugins.eu/WebViewGetFormattedText.shtml), [WebView.CopyFormattedText](http://www.mbsplugins.eu/WebViewCopyFormattedText.shtml) and [RichText.ReadWebviewer](http://www.mbsplugins.eu/RichTextReadWebviewer.shtml) for iOS and FileMaker 16.
- **Version 7.4**
    - Added [WebView.ClearSelection](http://www.mbsplugins.eu/WebViewClearSelection.shtml), [WebView.Copy](http://www.mbsplugins.eu/WebViewCopy.shtml), [WebView.Cut](http://www.mbsplugins.eu/WebViewCut.shtml), [WebView.Paste](http://www.mbsplugins.eu/WebViewPaste.shtml) and [WebView.SelectAll](http://www.mbsplugins.eu/WebViewSelectAll.shtml).

### Example Databases

- [WebViewer/WebView Copy and Paste](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WebViewer/WebView%20Copy%20and%20Paste.shtml#1Button11.0000000157.000000045.0000000263.0000000LayoutObjectAnchor_)
- [WebViewer/WebViewer Copy Text](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WebViewer/WebViewer%20Copy%20Text.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 7.4pr2](https://www.mbsplugins.de/archive/2017-08-14/MBS_FileMaker_Plugin_version_7/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 11st August 2017 , last changed 4th November 2021

  
[WebView.Cookies.Query](WebViewCookiesQuery.md) - [WebView.CopyFormattedText](WebViewCopyFormattedText.md)

[HTML Version](WebViewCopy.shtml)