Executing arbitrary JS code in a MATLAB Online session

35 Views Asked by At

TL;DR

Is it possible to get a handle to the web window containing a MATLAB Online session, from within it, to be able to execute arbitrary JS code?


MATLAB Online is a web-app version of MATLAB. As is the case with MATLAB UIFigures, this web-app also uses a combination of Dojo + react, so theoretically a tool like mlapptools (disclosure: I'm one of the authors of this tool) could be used to customize figures. However, unlike a UIFigure, which has (or at least used to have) an embedded CEF controller which exposes an executeJS() function, a figure within MATLAB online (which is essentially a web page) is a simple div which contains an iframe with the figure's contents.

The undocumented method to get webwindows in a "regular" MATLAB session, matlab.internal.webwindowmanager.instance.findAllWebwindows(); doesn't work here, and /MATLAB/toolbox/matlab/uitools/uicomponents/components/+matlab/+ui/+internal/+controller/+platformhost/MOFigurePlatformHost.m doesn't provide any useful hints.

An so - is there a way to get an executeJS capability in MATLAB Online?

See also:

  1. Source of the recent bundle.app.js
  2. Direct link to MATLAB Online for R2023a
  3. Undocumented MATLAB blog: Customizing uifigures part 1
0

There are 0 best solutions below