简体   繁体   English

如何在Lynx中查看我的网页时隐藏div?

[英]How can I hide a div when my webpage is viewed in Lynx?

My website has a div element (in form of a block) that I want to make invisible whenever a user visits the website through a text based browser like Lynx, that doesn't support JavaScript. 我的网站有一个div元素(以块的形式),当用户通过像Lynx这样不支持JavaScript的基于文本的浏览器访问网站时,我希望它不可见。

Basically what command or code do I need to write in order for this to happen? 基本上我需要编写什么命令或代码才能实现此目的?

Since you can't run javascript there, you have to not send that div in the first place for it to be invisible in the text-mode browser. 由于您无法在那里运行javascript,因此您必须首先不发送该div,因为它在文本模式浏览器中不可见。

You can make a server side user-agent check and do not render that div. 您可以进行服务器端用户代理检查,不要渲染该div。 Lynx user agents: http://www.useragentstring.com/pages/Lynx/ Lynx用户代理: http//www.useragentstring.com/pages/Ly​​nx/

You can set the div invisible by default. 您可以默认将div设置为invisible
and make it visible in your js code. 并使其在您的js代码中visible
Thus it'd not appear on a text-mode browser. 因此它不会出现在文本模式浏览器上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM