禁用 webOS 电话链接
我曾经遇到过一个问题,iPhone 版 Safari 会将电话链接添加到我的 HTML 中。这会破坏我的代码,因为它取决于
的文本值。之前:
<div id="DontTouchMyHTML">8211812</div>
之后:
<div id="DontTouchMyHTML"><a href="tel:8211812">8211812</a></div>
所以我为 IE iPhone Safari 添加了神奇的元修复。 Safari 开发中心:电话链接
<meta name = "format-detection" content = "telephone=no">
这解决了问题。
但随后出现了带有 Safari 的 Palm Pre webOS。现在我遇到了一些问题,上述修复不起作用。我假设基于 Safari/AppleWebKit 它将遵循相同的规则。我想不是。
我寻找了 Palm Pre webOS 电话链接的开发人员参考,但找不到解决方案。
违规用户代理:
Mozilla/5.0 (webOS/1.3.1; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/1.0
I once had a problem where Safari for iPhone would add phone links to my HTML. This would break my code because it depended on the text value of <div id="DontTouchMyHTML">
.
Before:
<div id="DontTouchMyHTML">8211812</div>
After:
<div id="DontTouchMyHTML"><a href="tel:8211812">8211812</a></div>
So i added the magical meta fix for IE iPhone Safari.
Safari Dev Center: Phone LInks
<meta name = "format-detection" content = "telephone=no">
And that solved the problem.
But then came along the Palm Pre webOS with Safari. Now I'm having the some problem and the above fix does not work. I assumed that being based off Safari/AppleWebKit it would follow the same rules. I guess not.
I've looked for a developer reference for Palm Pre webOS phone links but cannot find a solution.
Offending User Agent:
Mozilla/5.0 (webOS/1.3.1; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/1.0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以确定用户代理是否是将这些数字转换为链接的浏览器,然后使用 HTML 实体将 8211812 转换为
但老实说,我认为这是一个可怕的解决方案。
如果没有开发人员 API 来阻止您的情况,这是我能想到的唯一方法。
You could determine if the useragent is a browser that will convert these numbers to links, and then use HTML Entities to convert 8211812 to
However I honestly think it's a horrible solution.
Providing there is no developer API to prevent your situation, that's the only way I can think of.