Tutorial :finding visited links in a jetpack extension



Question:

Is there way in jetpack(mozilla's extension development framework) , to find the the visited links in a page?

BTW: jquery's a:visited works in firebug , but not in jetpack. i'm guessing it's part of jetpack's security.


Solution:1

You can't read whether a particular link is selected from JavaScript, you can only do it indirectly, using a Selector. Consequently a:visited is not supported by jQuery/Sizzle; if it works for you, that's only because jQuery is farming off the selector to the browser's native querySelectorAll interface; on older browsers that don't support Selectors-API Level 1, it won't work.

You can try document.querySelectorAll('a:visited') directly to see whether the environment allows history reading. The spec allows a browser to block it, and certainly IE does; I don't know about JetPack.

The nasty hack that was used to snoop history previously, which might still be applicable, is to add a rule to the stylesheet targeting visited links and see if the element has been matched by looking at its currentStyle/getComputedStyle (.css in jQuery).


Solution:2

Except the solution suggested by @bobince has been eliminated as a security issue in the latest versions of Firefox.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »