开发者

Select-copy from a web page adds the page hyperlink to the clipboard

If you select a paragraph from eg http://www.wired.com/gadgetlab/2010/01/ipad-flash/ and paste it in word, you will notice that the link to that page has been added at the end of the paragraph.

Here is an example:

Some of Apple’s promotional material about the iPad implies the device’s Safari browser can load Adobe Flash content. However, demonstration units of the tablet, including the one presented by Steve Jobs, could not, and a consumer has already filed a complaint to the Federal Trade Commission alleging false advertising.

Read More http://ww开发者_如何学Gow.wired.com/gadgetlab/2010/01/ipad-flash/#ixzz0f2nM0huW

How do they do that???

Also they add #ixzz0f2nM0huW at the end of the link and when you follow the page the text that was selected appears highlighted!

Is there a javascript library to do this?


They use Tynt Insight. It is a commercial JavaScript library which comes with a free version that includes the "attribution link" feature described in your question.

You can see it referenced in their HTML within the <head> tag:

<!-- Tynt Tracer> --> 
<script type="text/javascript"> tyntVariables = {"ap":"Read More"}; </script> 
<script type="text/javascript" src="http://tcr.tynt.com/javascripts/Tracer.js?user=ac4i_23GOr3QjHab7jrHcU&s=112"></script> 

As Tim Down noted in a comment above, Anirvan gave a very good briefing on the internals of the Tynt script, in a separate Stack Overflow post.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜