Welcome to WebmasterWorld Guest from

Forum Moderators: ergophobe

Message Too Old, No Replies

Copy and Paste without hidden text

Stop following me about!

9:45 am on Sep 24, 2008 (gmt 0)

New User

5+ Year Member

joined:Sept 24, 2008
posts: 2
votes: 0


I'm currently working on a page that contains a list of results for a search. One of the things required is hit highlighting for the search term.

So if you were to search for "stuff" it would return:

Dramatic stuff in Political Play

However we have made it accessible for speaking browsers such as JAWS. So it returns:

Dramatic hit stuff in Political Play

As such the html output is:

Dramatic <span class="hit"><span class="hiddenText">hit</span>stuff</span> in Political Play

where class "hit" does the bold, underline, highlighting etc for the browsers, and class "hiddenText" does the obvious and hides the word (to the left of the viewable area) "hit" unless read out.

Unfortunately if a user selects the text "Dramatic stuff in Political Play" and then tries to copy and paste it (into notepad or Word for example), they get "Dramatic hit stuff in Political Play".

Is it possible to do something so that if a user copies and pastes the word "hit" is not picked up?


10:20 am on Sept 24, 2008 (gmt 0)

Preferred Member

10+ Year Member

joined:May 29, 2007
posts: 578
votes: 0

How about using an @media aural stylesheet [w3.org]?


@media aural { 
@media screen {

I don't have a screen reader on this machine, so I haven't tested the idea

9:18 am on Sept 25, 2008 (gmt 0)

New User

5+ Year Member

joined:Sept 24, 2008
posts: 2
votes: 0

Thanks for the suggestion lavazza, unfortunately it was a no-goer. It resulted in:

Dramatic hitstuff in Political Play

as has many other things I have tried :(

We're using Tapestry along with Prototype and Scriptaculous, so I'm wandering if I should be looking more down that route than traditional code and css?


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members