What you could do is add an onclick to all of your links. With jQuery you could do the following:
$($('a').click(function(){
if(unsavedWork){
return confirm("You have not saved your work, would you like to leave anyway?");
}else{
return true;
}
}););