Availability: >= 3.0

Type: Object Property

Description: Sets the HTML specification for content generated by the editor.


$editor->htmlVersion string $version;

This property provides a simple way to set the version of HTML that content generated by the editor should conform to.

If you are editing a complete HTML document that includes a doctype declaration then you should not need to set this property. This property is intended for when editing a snippet of HTML code where the HTML version is unknown. 

This property will affect the format of HTML code generated by the editor and the way the HTML code is rendered in the editor's design and preview panes. It will also affect the availability and function of certain WysiwygPro features.

The value should be a space separated list of keywords. The value is not case sensitive.

Example values:

For HTML 4.0 Transitional you could use any of the following:

  • 'HTML'
  • 'HTML 4.0'
  • 'HTML Transitional'
  • 'HTML 4.0 Transitional' 

For HTML 4 Strict you could use any of the following:

  • 'HTML Strict'
  • 'HTML 4.0 Strict'

For XHTML 1.0 Transitional you could use any of the following:

  • 'XHTML'
  • 'XHTML 1.0'
  • 'XHTML Transitional' 
  • 'XHTML 1.0 Transitional'

For XHTML Strict you could use:

  • 'XHTML Strict'
  • 'XHTML 1.0 Strict'

For XHTML 1.1 you could use:

  • 'XHTML 1.1'

Please note: XHTML 1.1 is a modular declaration allowing your to create your own doctype that includes modules not supported by the default XHTML specification.

For this reason there are some additional key words that you can add to the end of the XHTML 1.1 string to include support for extra features:

  • 'target' adds support for the target attribute.
  • 'start' adds support for the start attribute (since version 3.1.3)

Other keywords may be added in future updates.

The best explanation I've found of this can be seem here (but there are some minor technical errors):

Example: XHTML 1.1 with support for the target attribute.

$editor->htmlVersion  'XHTML 1.1 TARGET';

Note: if you are using a custom doctype then you should also set the doctype property.