Jquery: mark links as visited without opening them?

天涯浪子 提交于 2019-12-06 03:55:39

You could ...

1) Try using AJAX (ie. $.get(a.href)), but I don't know if that would actually work.

2) Try styling the links to look visited (by changing their CSS "color" attribute), although this approach won't actually make them in to visited links

3) If neither of those work, you could try doing something like:

3A) Create a hidden IFRAME on the page

3B) Add a target attribute to every A tag on the page to make them point to the hidden IFRAME

3C) Invoke $("a").click() inside that each loop (possibly with a delay of some sort between each one to give the page time to load)

If none of those work, I think you're out of luck.

Create a link that is visited (i.e. set its href to window.location), and set each of your target links' styles to that newly created link's computed style.

It's not really possible in the way you want however you could copy the CSS attributes of a:visited to a new class called "visited" or whatever then apply them to the links you want.

$('a').addClass('visited');
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!