[英]Symfony2: Twig detect noscript
I want to render a table which holds all entity data. 我想呈现一个包含所有实体数据的表。
There should be a noscript version which additional renders two colomns with editing and deleting operations and a default javascript version where it gets solved dynamicaly over a sidebar. 应该有一个noscript版本,该版本可以通过编辑和删除操作来另外渲染两个列,并且应该是一个默认的javascript版本,可以通过边栏动态地对其进行求解。
Is there a way to let this decision to twig? 有没有办法让这个决定发生变化? So that twig detects if javascript is supported and if not renders the additional fields?
这样那个树枝可以检测是否支持javascript,如果不支持,则呈现其他字段?
Regards 问候
Twig-specific code? 细枝专用代码? No
没有
HTML code? HTML代码? Yes
是
You can make use of the <noscript>...</noscript>
tag to display something to browsers without JavaScript support. 您可以使用
<noscript>...</noscript>
标记向不支持JavaScript的浏览器显示某些内容。
Alternatively, you can display the two additional columns to everybody and use JavaScript to hide them. 另外,您可以向所有人显示另外两列,并使用JavaScript隐藏它们。 This way, people without JavaScript see them, people with JavaScript don't.
这样,没有JavaScript的人看到了,有JavaScript的人看不到。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.