4
$\begingroup$

I tried deploying a manipulate as an iframe using EmbedCode as follows, to no avail - my question is two-fold:

1. How to get a basic manipulate to work as an iframe?

  • In all browsers?
  • Without the wolfram cloud advertisement banner?

2. How to protect it from users editing it?

  • What are the correct Permissions settings?
  • Must you set them on both CloudDeply and EmbedCode?
  • How to shrink wrap it so the user doesn't see lots of excess space?
  • How to remove cell brackets?

Here is what I tried to deploy:

EmbedCode[
 CloudDeploy[
  Manipulate[
   ContourPlot3D[
    x^2 + y^2 + a z^3 == 1, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, 
    Mesh -> None], {a, -2, 2}], Permissions -> "Public"], 
 Permissions -> "Public"]

The result (in safari) is:

enter image description here

Update: It crashes less frequently in firefox, but is still weirdly editable:

enter image description here

$\endgroup$
6
+50
$\begingroup$

This will do most of what you want:

Manipulate[
  ContourPlot3D[x^2 + y^2 + a z^3 == 1,
   {x, -2, 2}, {y, -2, 2}, {z, -2, 2},
   Mesh -> None],
  {a, -2, 2}] //

 EmbedCode[
   CloudDeploy[#, Permissions -> {All -> {"Read", "Interact"}}], 
   ImageSize -> {50, 80} + ImageDimensions@Rasterize@#] &

What this does:

It uses the ImageSize argument to EmbedCode. To get the dimensions of the Manipulate I did the standard ImageDimensions@Rasterize trick. The padding is just because CloudCDF (the output format for this sort of interactive material) is basically a notebook and I'm not sure there's a way to make it smaller or left-aligned.

Sadly, the concept of WindowSize in a cloud notebook isn't implemented (and it's not wholly clear what that should mean anyway) so there's no better way to shrink-wrap your Manipulate.

The bar seems to be there for good. WRI surely wants people to know that they developed the code for that.

Instead of "Public" use the explicit spec All->{"Read","Interact"}. "Read" because they need to see it. "Interact" because they should be able to move the manipulate. But since "Write" is not set, anything they do will not be saved. It will, however, eat your cloud credits. Unfortunately if you disable "Interact" it's not possible to see the content at all, because that first generation event is an interaction.

Of course, if you didn't want the Manipulate to be manipulable, you would have just deployed the plot.

When I deployed this, I didn't see cell brackets, which I'm guessing is a result of "Write" not being set. I was able to make new cells in the iframe, but no content appeared, which is what I think you want.

|improve this answer|||||
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.