Ajax and link how to make a: visited work when using ajax

2

I recently made a website this week, vhtvshows.com.br. When I click on a series to watch and choose the episode, the ajax takes the link and places it in my div, but when I return the link it is not in the color I put in the CSS:

#exemplo a:visited{
color:#0099ff;
}

Now when I open the link in a new tab where ajax will not work, it works perfectly with a:visited .

Does anyone know what I can do to validate a:visited even using ajax? I do not want to have to use "iframe".

    
asked by anonymous 13.02.2015 / 12:11

1 answer

1

Unfortunately, I do not think it's possible, because the: visited will only work for sites that are present in the browser history.

However you can still add a class to visited links.

If your browser supports html5, you can use object history to force the AJAX link to go into history:

var linkOpen = document.getElementById("<ID do seu Link>");
var hrefAtual = window.location.href;
history.pushState(null, null, linkOpen.href);
history.pushState(null, null, hrefAtual);

JSFIDDLE

    
13.02.2015 / 12:47