views:

27

answers:

2

Hi

Is it possible to write a jQuery scripts that visits all links on page from the console in firefox, so next time i visit the page they are all marked as visited?

Chers! Johan

A: 

You can use GreaseMonkey plugin. After page is loaded you can fire code will emulate navigation on the site. Although I'm not sure if the links will be marked as visited.

Jenea
+1  A: 

Suppose you could:

$('a[href]').each(function() { $.get($(this).attr('href')); });

This only visits absolute links, though. $.get() handles both absolute and relative references so we're only checking for the existence of the href attribute.

jensgram
Why not just $('a'), and then check to make sure it has a href, to include relative links?
yc
@yc Because I didn't realize that `$.get()` could handle relative links. Of course it can :) Will edit answer.
jensgram
I ended up using the .load(url divId) on all links on the page.
Johan Albertsson