【问题标题】:Crossrider: change title of a linkCrossrider:更改链接的标题
【发布时间】:2012-12-30 01:00:43
【问题描述】:

使用 crossrider,是否可以在 dom 中获取链接对象并更改链接的标题。 我正在创建一个插件来检测恶意网站并在链接前添加 [Malicious]。

我可能可以通过解析字符串来做到这一点,但如果它被 DOM 支持,它会让我的生活变得更加轻松。

【问题讨论】:

    标签: crossrider


    【解决方案1】:

    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());
    });
    

    【讨论】:

      猜你喜欢
      • 2023-03-19
      • 1970-01-01
      • 2017-08-03
      • 1970-01-01
      • 2014-02-24
      • 2014-07-08
      • 1970-01-01
      • 1970-01-01
      • 2021-04-10
      相关资源
      最近更新 更多