The question How do i accept MathML? already explains how to handle output from Windows 7 and Windows 8 Math Input Panel using native Windows code.
Is it possible to do the same with any web browser using just JavaScript (that is, no silverlight or any other plugin allowed)? I understand that the MathML input is on the clipboard but it’s declared as non-text (despite the fact that it really is application/mathml
or more exactly UTF-16LE encoded XML with MathML markup with a BOM at the start of the data
). My target is to get the MathML
as UTF-8 encoded text
and further embed that text via TinyMCE. The resulting MathML will be later rendered by MathJax
but could be processed by the server, too. The missing part is to extract the correct data from the clipboard. As far as TinyMCE and JavaScript (as I’m using it) sees the clipboard, it’s always empty when it really contains the formats described in the How do i accept MathML?
I’d prefer supporting MSIE 10 and latest versions of Firefox and Google Chrome. However, in short run I’d be okay supporting only a single browser running on Windows 8. I’d really really want to avoid any plugin dependency even for supporting a single browser running on Windows 8.
If somebody can show me the code to display MathML
from Math Input Panel in an alert()
using just JavaScript (jquery
and TinyMCE
dependencies are okay if those help), I can handle the rest.
Advertisement
Answer
Access to the clipboard is not possible using javascript on a webpage due to the fact that javascript cannot reach out of the browser sandbox. As for the correct flovour choosen to paste from the clipboard it looks impossible to do this without a browser AddOn.