click hijack visited css
by ryanttb
HTML
<a href="http://wordpress.org/news/2013/12/parker/">WordPress</a>
<a href="http://fjdkshfjdkshkjfdsfkdhsjk.com/" data-ir-location="http://cyber.law.harvard.edu/">Nothing</a>
<h2>iframe tests</h2>
<iframe id="test" name="test" src="" width="320" height="200" border="1"></iframe>
<div class="iframe-output">
</div>
CSS
a {
text-decoration: none;
}
a:visited {
color: #ff0000;
}
JavaScript
$(function( ) {
// also blocked now: http://stackoverflow.com/questions/13613148/detect-visited-link-with-jquery
/* visited tests */
$if = $('iframe');
$output = $('.iframe-output');
/* base click handler */
$('a').click(function(e) {
$if.prop('src', $(this).prop('href'));
var clickedLink = this;
setTimeout(function() {
$output.html($output.html() + '<br>' + $(clickedLink).css('color'));
// used to be able to detect the :visited color change but no longer
if ($(clickedLink).css('color') !== '#ff0000') {
$output.html($output.html() + '<br>error loading');
} else {
$output.html($output.html() + '<br>loading ok');
}
}, 500);
return false;
});
});