clipboard_get_text

This function will return a string of the text contained on the clipboard. If no text is stored it will return an empty string "".

NOTE This function is only valid on the Windows, Android, MacOS, iOS, HTML5 and Opera GX targets.

On HTML5, clipboards are not supported on Firefox without the use of an extension, and are not supported on Internet Explorer at all.

Additionally, clipboard functionality may be affected by browser permissions and the user may need to allow clipboard permissions when prompted, otherwise the clipboard may not function.

 

Syntax:

clipboard_get_text();

 

Returns:

String

 

Example:

if (clipboard_has_text())
{
    str = clipboard_get_text();
    clipboard_set_text("");
}

The above code checks the clipboard for text and if it contains any, it is read as a string into the variable "str". Finally the clipboard is cleared by setting it to an empty string.