Copy and paste from JavaScript: custom types

Dear fellows of the www-math mailing-list,

Many of you know how difficult it is to activate the clipboard so that 
web-pages can offer copyable content that interoperate with other sites. 
Several apps (including MS Word) work around this by transporting MathML 
source code  in the plain text. But that has many problems.

A novelty has appeared recently in the Clipboard APIs in JavaSCript 
which has an implementation on Blink-based browsers (Chrome, Edge, 
Opera): Custom web types can be copied by web-pages if authorised. And 
these custom web types have exactly the content that was dictated (as 
opposed to HTML or pictures which get sanitized). Apps that want to use 
it need to follow a bit of naming conventions and will have to sanitize 
themselves.

That means that a web-page can have JavaScript that exposes MathML and 
TeX and MathML-content and… and that receiving apps or websites can 
also read that without some filtering happening through the pipe.

A demo is done in [this blog 
page](https://mathmlmuses.netlify.app/trymathml-copy-customtypes/) which 
copies a slightly big MathML expression.

This is very exciting for the interoperability of formulæ on the web 
and I am sure that desktop apps will benefit of this when this is 
stabilised!

Paul

Received on Tuesday, 20 September 2022 00:08:42 UTC