Hi,

I made a mistake with this message in that widgets/interact is not
relevant.  I was confused because the SageCell server just
happened to randomly stop working (or be slow)  **coincidentally**
exactly when I was trying widgets.  Of course nothing at
all works without CORS setup properly, and when it is,  then normal
output and widgets work equally well.

That said, I still think a better error message and documentation
related to CORS rather than silently failing might be better.

 -- William

On Wed, Jan 29, 2020 at 11:20 AM William Stein <[email protected]> wrote:
>
> Hi Andrey (and the sage-cell list),
>
> I was just demoing the Sage cell server,  and hit a confusing issue:
>
> If you use an interact at https://sagecell.sagemath.org/ like this
> then it works fine:
>
> @interact
> def f(n=2020):
>     print(factor(n))
>
> But if you embed an interact in a "random" static site via the simple
> directions, then it is completely broken (email will probably mangle
> this, but you get the point, and I also attached a screenshot).  By
> "broken" I mean that there is a spinner forever and no output appears:
>
> <script 
> src="https://sagecell.sagemath.org/static/embedded_sagecell.js";></script>
> <script>sagecell.makeSagecell({"inputLocation": ".sage"});</script>
>
> <div class="sage">
> <script type="text/x-sage">
> @interact
> def f(n=2020):
>     print(factor(n))
> </script>
> </div>
>
> The interacts at https://wiki.sagemath.org/interact *do* work though.
>
> If you expand a sage cell at
> http://linear.ups.edu/html/section-SSLE.html then try to put an
> interact in it, that also does NOT work.
>
> Of course, actually looking at the console log reveals the problem:
>
> Access to XMLHttpRequest at
> 'https://sagecell.sagemath.org/kernel?CellSessionID=7dce1ecb762c41868c96f9af39df6ea8&timeout=0&accepted_tos=true'
> from origin 'https://cocalc.com' has been blocked by CORS policy:
> Request header field x-xsrftoken is not allowed by
> Access-Control-Allow-Headers in preflight response.
>
> So to get widgets to work with the sagecell server, I have to
> configure the site hosting my static html to allow certain types of
> cross domain access that is denied by default.  That's all fine and
> good, but...
>
> (1) is there anything documented anywhere about issues with CORS +
> sagecell server?  I googled and could find absolutely nothing at all,
> and no issues in the sagecell issue tracker.
>
> (2) Wouldn't it be nice if instead of the output just spinning forever
> and things being broken, the client sagecell could say "sorry, widgets
> are not available due to the CORS policy of the hosting website.
> Please see this link for more details...." or something like that?
>
> Just curious if this has come up before, or should I create a ticket at
>
> https://github.com/sagemath/sagecell/issues
>
> ?
>
>
>
> --
> William (http://wstein.org)



-- 
William (http://wstein.org)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-cell" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-cell/CACLE5GA6%2ByCXrX-n-hE1VXmGg-KUpFtOtTX_7iL-ZWZKAgzQyg%40mail.gmail.com.

Reply via email to