【发布时间】:2012-12-30 01:00:43
【问题描述】:
使用 crossrider,是否可以在 dom 中获取链接对象并更改链接的标题。 我正在创建一个插件来检测恶意网站并在链接前添加 [Malicious]。
我可能可以通过解析字符串来做到这一点,但如果它被 DOM 支持,它会让我的生活变得更加轻松。
【问题讨论】:
标签: crossrider
使用 crossrider,是否可以在 dom 中获取链接对象并更改链接的标题。 我正在创建一个插件来检测恶意网站并在链接前添加 [Malicious]。
我可能可以通过解析字符串来做到这一点,但如果它被 DOM 支持,它会让我的生活变得更加轻松。
【问题讨论】:
标签: crossrider
Crossrider 扩展支持 jQuery ($) 对象,因此您可以使用它从 extension.js 文件中获取链接,如下所示:
appAPI.ready(function ($) {
// Where <linkSel> is the selector for retrieving the link or links you require
$(<linkSel>).text(); // retrieves the text for the specified <linkSel> object
// OR the following to prefix the link's text with '[Malicious] '
$(<linkSel>).text('[Malicious] ' + $(<linkSel>).text());
});
【讨论】: