3.18.2Copying text to the clipboard

The framework offers a CopyTextToClipboard() function for copying (plain) text to the clipboard. For example:

// Note: displays its own toast, confirming that the copy has happened

Framework.CopyTextToClipboard("My text");

Two things in particular to note about this function:

Widgets cannot use the normal navigator.clipboard because of their sandboxing. They must use this function instead.

Scripts and UDIs can use this function. They would not otherwise be able to access the clipboard because of not being documents and having no navigator.clipboard.