New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run javascript from widget callback #2458
Comments
I think so, using
|
Yes, although this kind of javascript injection is not allowed in jupyterlab.
We have a solution for this that was used in ipysheet using web workers to sandbox the unsafe js, although the executed javascript does not have access to the DOM of the main page or the js context of the main page. |
@SylvainCorlay which lab version that does not allow this? It work fine with lab 0.35 |
OK, my information is outdated. That used to not be allowed, which seems to be a good thing to me. |
Thank you all. Using
Any idea why ? |
@DYSpider13 I really do not recommand using this though. Injecting javascript is a big security red flag and may be disabled in many deployments of Jupyter. |
You can with the display Javascript trick above. That's a generic Jupyter thing, nothing to do with ipywidgets (living below the layer of ipywidgets). To Sylvain's point - a problem with executing javascript is that it most often makes your code only work in a single frontend (and often only a single major version of that frontend), so it has limited usefulness. The approach of ipywidgets in general is to get desired functionality into the frontend through whatever the frontend extension system there is and then triggering the functionality through a message to the frontend. |
How to substitute variable value inside code tag of HTML in ipywidgets `object_fit = [A.ISONoise(always_apply=False, p=1.0, intensity=(0.1, 0.5), color_shift=(0.01, 0.05))] h = HTML(value='<{size}> The value inside code keeps verying. So, how to substitute it. I'm new to HTML |
I want substitute the object_fit variable inside the code tag |
Hello,
Is it possible to execute a javascript inside a widget callback (a button for instance) ? If not, is there an alternative for that ?
Best
The text was updated successfully, but these errors were encountered: