Cross posted on mathematica.stackexchange.com
Question and requirements
Is it possible to HTTPRedirect
from a Cloud CDF via e.g. Button
action?
I need an interactive cloud cdf around it.
The action would not only redirect but evaluate arbitrary code prior to that.
If it matters the target page does not need to be any page but an arbitrary CloudObject
should do.
No, I don't want to hide old stuff and show new to the user, I really need to redirect.
No, open in new tab does not count.
So it would work analogously to this form's submit button:
CloudDeploy[
FormFunction[{"go on and submit"}
, Module[{link}
, link = CloudPut[RandomReal[], Permissions -> "Public"]
; HTTPRedirect[link]
] &
]
, Permissions -> "Public"
]
Problems
Wasn't able to achieve that, here's why:
Form/ApiFunctions
where HTTPRedirect
works well can't have interative CDFs embedded inside:
CloudDeploy[
FormFunction[
{ "this is ok"
, ExportForm["this is not ok", "CloudCDFElement"]
}
, foo
]
, Permissions -> "Public"
]
>
and I can't trigger HTTPRedirect
from cloud CDF, nothing happens:
CloudDeploy[
ExportForm[
Button["Submit", Print[1]; HTTPRedirect["http://www.wolfram.com"]],
"CloudCDFElement"
], Permissions -> "Public"
]
>