You can check history length by jQuery and if can not possible to go back you can remove it.
First in html page introduce a hyperlink:
<a href="javascript:void(0)" class="back_link">Back</a>
Then add the jQuery code block:
<script type='text/javascript'>
if(history.length <= 1) {
jQuery(".back_link").remove();
}
jQuery(".back_link").bind("click", function() {
if(history.length > 1) {
parent.history.back();
}
return false;
});
</script>
First in html page introduce a hyperlink:
<a href="javascript:void(0)" class="back_link">Back</a>
Then add the jQuery code block:
<script type='text/javascript'>
if(history.length <= 1) {
jQuery(".back_link").remove();
}
jQuery(".back_link").bind("click", function() {
if(history.length > 1) {
parent.history.back();
}
return false;
});
</script>