0

Using crossrider, is it possible to get link object in a dom and change the link's title. I am creating a plugin that detect malicious site and add [Malicious] in front of the link.

I probably could do this by parsing strings, but if it is supported by DOM, it would make my life so much easier.

user156144
  • 2,215
  • 4
  • 29
  • 40

1 Answers1

4

Crossrider extensions support the jQuery ($) object and hence you can use it to obtain your link from within the extension.js file, as follows:

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());
});
Shlomo
  • 3,763
  • 11
  • 16