如何定位基于文本的浏览器?

发布于 2024-11-03 12:55:17 字数 104 浏览 3 评论 0原文

我想添加标记,使基于文本的浏览器(链接、elinks、lynx)的用户更容易使用我的网站。我将能够基于 useragent 提供该网站的特殊版本,但是基于文本的浏览器可以很好地处理哪些标记功能?

I'd like to include mark-up that makes it easier for users of text-based browsers (links, elinks, lynx) to consume my site. I'll be able to serve this special version of the site based on useragent, however what mark-up features do text-based browsers handle especially well?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

我爱人 2024-11-10 12:55:17

最好的选择就是大量使用 CSS 来进行所有格式设置。基于文本的代理不太可能支持所有内容,因此,如果您将所有样式信息放入外部样式表中(主要是为了便于维护),并且只在需要时使用 class 属性,那么您可能会发现网站正常降级。大多数(所有?)浏览器都附带某种形式的开发人员工具栏,因此您可以根据需要禁用 Firefox、IE、Chrome [任何] 中的样式,并且您将了解纯文本浏览器可能会如何看到它。

唯一需要注意的是表格——lynx 不支持它们,但其他基于文本的浏览器支持(或多或少)。再次强调,只要确保页面尽可能优雅地降级即可。

最终,在所有布局和大部分格式中使用 CSS 应该意味着与基于文本相关的大多数担忧都应该得到解决。

Your best bet is just to make heavy use of CSS for all the formatting. It's unlikely that text-based agents will support everything, so providng you drop all style info in an external stylesheet (mostly for ease of maintenance), and just use class attributes where needed, then you'll probably find the site degrades gracefully. Most (all?) browsers come with some form of developer toolbar so you can disable styles within, say, Firefox, IE, Chrome [whatever] on demand and you'll get an idea how it's likely to be seen by text-only browsers.

The only thing to be careful of is tables -- lynx doesn't support them, but other text-based browsers do (to a greater or lesser extent). Again, just make sure the page degrades gracefully as far as it possibly can.

Ultimately using CSS for all your layout and a chunk of your formatting should mean that most worries related to text-based should be resolved.

扛起拖把扫天下 2024-11-10 12:55:17

我不知道您需要什么特殊标记。也许只是比平常更少的标记。尽可能少地使用 JS,因为它们只有少量支持。当使用 CSS 和花哨的对齐方式时,任何使网站在现代浏览器中看起来“漂亮”的标记很可能毫无价值,并且可能会成为障碍。根据您可能想要使用简单文本的内容。或者旧式页面(相当多的 GNU 页面像这样)。在线版本的“Unix 编程艺术”(http://www.faqs.org/docs/artu/index.html) 中的示例,非常简单的设计,易于在任何地方阅读和呈现。没有花哨或任何暗示的设计,只需发送一些链接和您。尽管它可能并不适合所有类型的内容。基本上保持尽可能简单,并尽量避免花哨的布局或任何布局,因为其中一些浏览器只是一个接一个地渲染块元素,并且左侧或右侧的菜单会到达底部或占据整个第一个屏幕向下滚动之前不会显示任何内容。在我看来,水平顶部菜单效果最好。当然,您也可以通过测试和导航来了解它的外观。

I don't know any special markup you would need for that. Maybe just less markup than usual. Use JS as little as possible since they have only marginal support. Any markup that is there to make site look "nice" in modern browsers when using CSS and fancy alignment is most likely worthless there and may be hindrance. Depending on content you might want use simple text. Or old style pages(quite some GNU pages like this). Example in on-line version of "Art of Unix programming" (http://www.faqs.org/docs/artu/index.html), very simple design that is easy to read and render anywhere. No fancy or any implied design, just text some links and you. Though it might not be suitable for all types of content. Basically keep it as simple as possible and try to avoid fancy layouts, or any layouts at all since some of these browsers simply render block elements one after another and menus that would be on left or right get to bottom or take up whole first screen with no content showing until one scrolls down. In my opinion horizontal top menus work best. And of course see how it looks for your self by testing and navigating there a bit.

还不是爱你 2024-11-10 12:55:17

您可以检查用户代理字符串。这是完整列表。您可以检查 lynx、links、elinks 和 w3m。但是,最好根本不检查代理字符串,并保持 html 干净简单。一些文本模式浏览器,如 elinks,确实有一些 javascript 支持。 CSS 支持有所不同,但底层 html 仍然可以工作。

某些文本模式浏览器(例如链接)具有图形模式,也可以在其中显示图像。

如果您坚持使用

>、 并对任何图像使用 alt="...",不会出错。

You can check for the user agent string. Here is a comprehensive list. You could check for lynx, links, elinks and w3m. However, it's better not to check for the agent string at all, and keep the html clean and simple. Some of the text-mode browsers, like elinks, does have some javascript support. The CSS-support varies, but the underlying html would still work.

Some text-mode browsers, like links, have a graphic mode, where images can be shown as well.

If you stick to <html>, <body>, <h1>, <p>, <a href="..."> and use alt="..." for any images, you can't go wrong.

心头的小情儿 2024-11-10 12:55:17

为了最好地服务器基于文本的浏览器,请确保使用简单的语义标记。在构建网站时,请牢记“内容为王”这一口号,并围绕内容而不是视觉模板设计结构。

当您的内容优先时,您的页面将因额外的标记和视觉元素而变得整洁,这些元素可能会使基于文本的浏览器感到困惑。

To best server text-based browsers, ensure that you use simple, semantic markup. Keep the mantra "Content is King" in mind as you build your site, and design the structure around the content rather than around a visual template.

When your content takes precedence, your page will be uncluttered by the extra markup and visual elements that may confuse the text-based browsers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文