简体   繁体   English

是否可以用HTML中的URL指定用户代理?

[英]Is it possible to specify user agent with URL in HTML?

I'm working on a mail server that sends HTML emails down to a mail client. 我正在使用将HTML电子邮件向下发送到邮件客户端的邮件服务器。 Can the HTML DOM be modified to indicate that either a single or all URLs ( <a href=""> elements) use a specific user agent? 是否可以修改HTML DOM以指示单个或所有URL( <a href="">元素)使用特定的用户代理? The integrated browser in our custom client could inspect the HTML to determine what user agent to use and then take that into account when opening the URL. 我们的自定义客户端中的集成浏览器可以检查HTML,以确定要使用的用户代理,然后在打开URL时将其考虑在内。

If it's possible to add a custom (non-standard) attribute to the <a> element or possibly a child element to it, that'd work too, if it's valid to do so. 如果可以向<a>元素添加自定义(非标准)属性,或者可以向其添加子元素,那么也可以,如果这样做是有效的。 Thanks in advance. 提前致谢。

Can the HTML DOM be modified to indicate that either a single or all URLs ( <a href=""> elements) use a specific user agent? 是否可以修改HTML DOM以指示单个或所有URL( <a href="">元素)使用特定的用户代理?

Not in any standard way. 没有任何标准方式。

If it's possible to add a custom (non-standard) attribute to the element or possibly a child element to it, that'd work too, if it's valid to do so. 如果可以向元素添加自定义(非标准)属性,或者可以向其添加子元素,那么也可以,如果这样做是有效的。

"non-standard" is practically invalid by definition. 根据定义,“非标准”实际上是无效的。

There is a loophole in data- attributes (since they are defined by the specification as a way to add extensions) but: data-属性存在漏洞(因为规范将它们定义为添加扩展的一种方式),但是:

  • "These attributes are not intended for use by software that is independent of the site that uses the attributes" “这些属性不适用于独立于使用该属性的网站的软件使用”
  • HTML 5 is a Candidate Recommendation, not a standard. HTML 5是候选推荐标准,而不是标准标准。

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

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