Show text only when link is clicked
I have a client which owns an index site. The index includes phone numbers for the companies listed. I want the phone number to not show up in search results and only show up when the user enters the index page and clicks a link. I don't currently use jQuery on the site, but I'm not apposed to adding it, if it makes thing开发者_如何学JAVAs easier (I'm guessing it will). Any ideas on how to implement this?
Personally, I would not rely on JavaScript to show information to my customers how they can contact me. Customers with deactivated JavaScript would be unable to contact me.
A solution would be to simply exclude the page with the phone numbers through a ROBOTS.TXT file.
Or, you could render the numbers as images.
If you want to use JavaScript to hide the phone number from search engines, you could break up the string and concatenate the pieces with document.write
:
document.write('Phone Number: ###' + '####');
It's important to develop code to work with and without JS enabled, its part of the W3C Accessability guides and good practice..
This maybe a little helpful
精彩评论