Flamingo.getEncoding()

The getEncoding() method returns character encoding used on the current page.

Syntax

Flamingo.getEncoding()

Parameters

None.

Return Value

Type Description
String Character encoding used on the current page, if specified.
null If character encoding is not specified on page.

Example

The example below demonstrates how to insert encoding declaration for mobile view.

Source HTML code available on your original desktop site page:

<html>
 <head>
   <meta charset="UTF-8" />
   <title>Document Title</title>
 </head>
</html>

You need to add the following code to your template to insert encoding declaration for mobile view:

<!--{if Flamingo.getEncoding() !== null }--><meta http-equiv="Content-Type" content="text/html; charset=<!--{= Flamingo.getEncoding() }-->" /><!--{/if}-->

The result will look like:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

See also