What text can be copied but not searched for?

Question!

I previously used the alt attribute of images to produce text that could reach the clipboard:

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?



Answers

It appears that the alt attribute is the instrumental piece here:

<img alt="Can't find me!"/>

The above element should display the alt text, however control-F and indexOf() methods will be unable to find it.

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?



Note: I posted this answer yesterday but deleted it because I didn't think I'd understood your question properly. But given the additional info you've posted, I actually think it may be what you're looking for. (if it isn't what you're looking for, please let me know and I'll delete it again)

Something like this:

This is some <span style='display:inline-block; width:0px; overflow:hidden; white-space:nowrap;'>copy me!</span>random text.

Should display This is some random text. on the browser, but when copied and pasted into Notepad, it should give you This is some copy me!random text.

By : Spudley


This video can help you solving your question :)
By: admin