diff --git a/src/pyj/utils.pyj b/src/pyj/utils.pyj index df5a9dc74c..ccaebbac8c 100644 --- a/src/pyj/utils.pyj +++ b/src/pyj/utils.pyj @@ -240,6 +240,9 @@ def sandboxed_html(html, style, sandbox): css = 'html, body { margin: 0; padding: 0; font-family: __FONT__ } p:first-child { margin-top: 0; padding-top: 0; -webkit-margin-before: 0 }'.replace('__FONT__', get_font_family()) css += style or '' final_html = f'
{html}' - # Microsoft Edge does not support srcdoc not does it work using a data URI. + # prevent context menu on right click in iframe + ans.addEventListener('load', def(ev): + ev.target.contentWindow.addEventListener('contextmenu', def(e): e.preventDefault();) + ) ans.srcdoc = final_html return ans