Fmylife.com has a nifty feature that when you copy the text from a post, it actually copies a LINK (html) so that when you paste it into your email/facebook/instant messenger/twitter/whatever it automatically will link to the post, giving them more traffic and more page views and more ad revenue, etc.
I looked into their javascript files but can't seem to find how they do it. How would one go about copying this beh开发者_运维问答avior?
The text in a post is actually an anchor <a>
with CSS modified text-decoration: none
. So , it looks like normal text, but indeed is a hyperlink.
So, when you click on it, you are redirected to the permalink of the post. Hence the behaviour.
精彩评论