什么文本可以复制但不能搜索? [英] What text can be copied but not searched for?
问题描述
我之前使用图像的alt属性来生成可以到达剪贴板的文本:
I previously used the alt attribute of images to produce text that could reach the clipboard:
样式属性能够隐藏文本,但隐藏文本仍然存在,可以使用indexOf,control-F等找到。
The style attribute is capable of hiding text, but hidden text still exists and can be found using indexOf, control-F and the like.
复制选择时是否有另一种方法来包含文本?
Is there another way to include text when a selection is copied?
推荐答案
这里的alt属性似乎是乐器:
It appears that the alt attribute is the instrumental piece here:
<img alt="Can't find me!"/>
上面的元素应该显示alt文本,但是control-F和indexOf()方法将无法找到它。
The above element should display the alt text, however control-F and indexOf() methods will be unable to find it.
我不需要隐藏这个文本,只是对indexOf()不可用但是提到style =display:没有;将阻止此工作(文本将无法到达剪贴板)。如果你需要隐藏文本,请使用style =font-size:0;,正如我之前在如何编写剪贴板看到但不可见的文本?
I don't need this text to be hidden, just unavailable to indexOf() but it won't hurt to mention that style="display:none;" will prevent this from working (the text will not reach the clipboard). If you need to hide the text, instead use style="font-size:0;", as I found earlier in How can I write text that the clipboard sees but isn't visible?
这篇关于什么文本可以复制但不能搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!