vfilimonov/pyppt

JavascriptClient: forbid execution of the code on page reload

Closed this issue · 2 comments

Because the javascript is embedded into the output of the cell, it will be added to the rendered HTML and thus executed every time when the notebook is loaded or webpage reloaded (e.g. on F5). I.e. if the server is running at this time - it will receive all the commands (set title, add/replace figure, add slide, ...), which will mess up the powerpoint slides which are open at the moment.

from the old README.md

The way how the client-server is implemented: the HTTP server is running on the local host and waits for the commands from the client. In case of "Option B", the client injects javascript to the IPython notebook, and this javascript is executed within the browser, talking to the pyppt-server, running on the same local machine. The figure from the matplotlib is embedded within the same javascript code. This creates two difficulties of the injection:

  1. The figure-in-javascript will be saved together with the notebook. So you will have two pictures embedded to the notebook in case of call of ppt.add_figure() - the one which is rendered in HTML page and the one which is in the script, i.e. it will take twice the space on the drive. The notebook will be even heavier if add_figure is told to use the picture with high resolution (e.g. add_figure(..., dpi=300)).

  2. Because the javascript is embedded into the output of the cell, it will be added to the rendered HTML and thus executed every time when the notebook is loaded or webpage reloaded (e.g. on F5). I.e. if the server is running at this time - it will receive all the commands (set title, add/replace figure, add slide, ...), which will mess up the powerpoint slides which are open at the moment.