RichText.ReadHTML
-----------------

Loads a HTML page as rich text.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [RichText](component_RichText.md) | [5.2](newinversion52.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ✅ Yes |

MBS( "RichText.ReadHTML"; HTML { ; Encoding; BaseURL } ) 

**MBS**( **"RichText.ReadHTML";** /\* Loads a HTML page as rich text. \*/  
**$HTML**; /\* The html text to load.e.g. "&lt;p&gt;Hello&lt;/p&gt;" \*/   
**$Encoding**; /\* Optional; The text encoding for text parameter.   
Default is native.e.g. UTF8 \*/   
**$BaseURL**) /\* Optional; The base URL for relative links.e.g. "http://www.mbsplugins.de" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| HTML | The html text to load. | "&lt;p&gt;Hello&lt;/p&gt;" |  |
| Encoding | The text encoding for text parameter.    Default is native.   Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the [FAQ](https://www.monkeybreadsoftware.com/filemaker/faq.shtml). | UTF8 | Optional |
| BaseURL | The base URL for relative links. | "http://www.mbsplugins.de" | Optional |

### Result

Returns OK or error.

### Description

Loads a HTML page as rich text.  
Does not work on server due to missing main thread support for Cocoa.  
  
Warning: The plugin can only read/write the styles/formats which Apple supports for their cocoa framework.  
  
Looks like font OpenSans will be converted to Times. You can avoid it by replacing 'OpenSans' with e.g. 'Helvetica' before reading HTML.  
  
See also [EmailParser.HTMLToPlainText](EmailParserHTMLToPlainText.md) function.  
### Examples

Read HTML:

 MBS ( "RichText.ReadHTML"; "&lt;p&gt;Schokoladenplätzchen&lt;/P&gt;" )  
Convert HTML to formatted text:

 Let ( \[   
r = MBS ( "RichText.ReadHTML"; "&lt;p&gt;Schokoladenplätzchen&lt;/P&gt;"; "UTF-8" );   
o = MBS ("[RichText.FormattedText](RichTextFormattedText.md)");  
r = MBS ( "[RichText.Release](RichTextRelease.md)" )  
\]; o )  
### See also

- [Clipboard.SetRTFText](ClipboardSetRTFText.md)
- [EmailParser.HTMLToPlainText](EmailParserHTMLToPlainText.md)
- [RichText.CopyToClipboard](RichTextCopyToClipboard.md)
- [RichText.FormattedText](RichTextFormattedText.md)
- [RichText.HTMLText](RichTextHTMLText.md)
- [RichText.ReadFile](RichTextReadFile.md)
- [RichText.ReadText](RichTextReadText.md)
- [RichText.ReadURL](RichTextReadURL.md)
- [RichText.WriteDOC](RichTextWriteDOC.md)
- [RichText.WriteRTF](RichTextWriteRTF.md)

### Release notes

- **Version 10.3**
    - Disabled [RichText.ReadHTML](https://www.mbsplugins.eu/RichTextReadHTML.shtml) for server to avoid someone calling it there.

### Example Databases

- [Mac only/RichText/Write Document](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20only/RichText/Write%20Document.shtml#1ScriptAnchor_)
- [Text functions/HTML to formatted text](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Text%20functions/HTML%20to%20formatted%20text.shtml#2ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 10.3pr10](https://www.mbsplugins.de/archive/2020-07-17/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 5.2pr8](https://www.mbsplugins.de/archive/2015-07-24/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 23th July 2015 , last changed 26th June 2023

  
[RichText.ReadFromClipboard](RichTextReadFromClipboard.md) - [RichText.ReadRTF](RichTextReadRTF.md)

[HTML Version](RichTextReadHTML.shtml)