本文介绍了从网页复制内容时注入文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个网站,在您突出显示的任何文本的末尾注入阅读更多:行,并从其页面复制。

I ran into a a site that injects a "Read More: " line at the end of any text that you highlight and copy from it's pages.

我已经从来没有见过这个,没有严重挖掘他们的代码,我找不到执行此操作的代码。

I've never seen this before, and without severely digging into their code, I can't find the code that does this.

任何人都知道如何做到这一点?

Anyone know how this is done?

示例:

复制一段文字,并将其粘贴到另一个应用程序中,然后会有一个阅读更多之后的行。

Copy a paragraph of text, and paste it into another application, and there will be a "read more" line afterwards.

推荐答案

Suite101正在使用名为。

Suite101 is using a 3rd party service called Tynt.

Tynt的JavaScript代码段位于

Tynt's JavaScript snippet is located at http://tcr.tynt.com/javascripts/Tracer.js

我为您探索了来源(在在线JavaScript美化器)。

I explored the source for you (with some help from the Online JavaScript beautifier).

所以这就是发生的事情:

So here's what's happening: