I found this piece of code that can detect if a user has already visited your web page by injecting a hidden link into the DOM and checking if the color of it is the same as the one for visited links.
function hasLinkBeenVisited(url) {
var link = document.createElement('a');
link.href = url;
document.body.appendChild(link);
if (link.currentStyle) {
var color = link.currentStyle.color;
if (color == '#ff0000')
return true;
return false;
} else {
link.setAttribute("href",url);
var computed_style = document.defaultView.getComputedStyle( link, null );
if (computed_style) {
if (computed_style.color == 'rgb(255, 0, 0)')
return true;
}
return false;
}
}
It works fine for desktop browsers, however it doesn't for Blackberry's. You guys know of a way of knowing?